Touch screen on PC as detect like a mobile

Skip to first unread message

Jérémy Guyenot

Dec 18, 2017, 8:33:12 PM12/18/17
to PDFTron WebViewer

i've buy a Dell XPS 15" with a touchscreen and the viewer is telling me "PDF document viewing is not currently supported by the mobile viewer."

I've to override the "PDFTron.WebViewer.prototype.isMobileDevice" to disable the test on "touch".

Have you planned another test?

My userAgent string: ""Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; Touch; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729; Tablet PC 2.0; rv:11.0) like Gecko""

The override:
* Detects if the current browser is on a mobile device.
* @return {boolean} true if this page is loaded on a mobile device.
PDFTron.WebViewer.prototype.isMobileDevice = function() {
return ((this.scrollbarWidth() === 0 && navigator.userAgent.match(/Edge/i))
|| navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i)
|| navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPod/i)
|| navigator.userAgent.match(/iPad/i) /*|| navigator.userAgent.match(/Touch/i)*/
|| navigator.userAgent.match(/IEMobile/i) || navigator.userAgent.match(/Silk/i));

Matt Parizeau

Dec 18, 2017, 9:06:22 PM12/18/17
to PDFTron WebViewer

WebViewer 3.1 has changed the check so that it always uses the desktop viewer when using Internet Explorer. However changing the check so that it doesn't look for "touch" would also work.

Matt Parizeau
Software Developer
PDFTron Systems Inc.

Jérémy Guyenot

Dec 20, 2017, 11:44:33 AM12/20/17
to PDFTron WebViewer
Thanks for the answer. I've test and it's ok.
Reply all
Reply to author
0 new messages