current-device icon indicating copy to clipboard operation
current-device copied to clipboard

Problem with touch-enabled Windows laptops

Open wilei opened this issue 11 years ago • 9 comments

I've met some problems with device.js's way to detect Windows Tablets.

Detection is done correctly in some cases, but when user has a Windows laptop, with touchscreen and Win8 (or 8.1) device.js detects user as tablet user. And some cases that detection is wrong, as user should be detected as desktop user, instead of tablet user.

One (maybe the only) way to handle this, for now, is to detect these users by OS architecture. ARM is tablet and Win64, x86 and wow64 are desktops.

Sample UA-string for some Lenovo model:

Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Win64; x64; Trident/6.0; Touch; MALNJS)

wilei avatar Jul 09 '14 07:07 wilei

I'm having a similar issue with a VMWare install.

mchambaud avatar Jul 11 '14 17:07 mchambaud

Same issue here - UA-String from my test device:

"Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; MATBJS; rv:11.0) like Gecko"

windowsTablet function checks for "touch" in the string to determine "tablet"

swatkins avatar Aug 19 '14 20:08 swatkins

I was investigating this just yesterday, and from what I found, the user agent reported for many Windows 8 tablets and touch-enabled laptops are the virtually the same. It may not be possible to accurately differentiate tablets from desktops without having to match device codes (which would suck).

ghost avatar Aug 20 '14 01:08 ghost

I think checking for the ARM string might be enough. Because tablets most likely run on Win RT. Link: http://msdn.microsoft.com/en-us/library/ie/hh920767%28v=vs.85%29.aspx

ghost avatar Aug 20 '14 09:08 ghost

Combined sales of Msft/3rd party Windows tablets show the Pro/Intel versions selling much better than the Surface RT on ARM. Checking for ARM will at least flag the Surface RT as a tablet correctly, but tablets, in the Msft world still "most likely" are Intel.

ghost avatar Aug 20 '14 14:08 ghost

ATTN: @chrismbeckett @netlovers @swatkins @mchambaud @wilei

From what I can tell, there is no reliable way to distinguish between Windows "Tablet" vs "Touch".

Perhaps a note should be added to the README, and the functions/classes renamed - thoughts?

matthewhudson avatar Aug 20 '14 14:08 matthewhudson

A note in the README sounds fine, I guess. But at least the ARM versions should be filtered out, so the script would be a bit more correct.

ghost avatar Aug 20 '14 14:08 ghost

On our use-case (which uses forked version of device.js) reason to seperate ARM devices from other Win8 devices is just because ARM devices are so slow -> we drop some of JS-features from those.

So I prefer note in README and ability to check if device is ARM device.

wilei avatar Aug 20 '14 15:08 wilei

I found 1 article that suggests doing feature detection for ActiveX since it is only on desktop, but that won't work for all browsers. In the end, for my own fork I am going to add the ARM check, and my final fallback is going to look at screen.width / devicePixelRatio or something to detect resolutions > 1200px. This would work when a tablet is hooked to a higher resolution ext monitor to provide a desktop experience.

ghost avatar Aug 20 '14 15:08 ghost