barisaydinoglu / Detectizr

A Modernizr extension to detect device, device model, screen size, operating system, and browser details
http://barisaydinoglu.github.io/Detectizr
MIT License
413 stars 77 forks source link

Wrong device type for windows 8 touch laptop PC (IE only) #28

Open udaykanthr opened 10 years ago

udaykanthr commented 10 years ago

In windows 8 touch laptop, device type is detecting as tablet for IE browser, but expected is desktop.

for all other browsers device type is appearing correct value as "desktop"

rajchetan commented 9 years ago

facing the same problem. Have pasted the useragent - “Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; .NET4.0E; .NET4.0C; Tablet PC 2.0; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729; McAfee; LCJB; rv:11.0) like Gecko”

barisaydinoglu commented 9 years ago

Windows has Tablet and Touch keywords in useragents of both tablet and touch enabled notebooks (hybrid devices). Do you know the right way to differentiate the Windows tablet and Windows touch enabled notebook?

jp-gauthier commented 9 years ago

I have the same issue. I can't make the distinction between Windows tablet and Windows touch screen desktop. On my Windows 8.1 touch screen laptop, I have the following html tag in IE11 :

<html class="js flexbox canvas canvastext webgl no-touch geolocation postmessage no-websqldatabase indexeddb hashchange history draganddrop websockets rgba hsla multiplebgs backgroundsize borderimage borderradius boxshadow textshadow opacity cssanimations csscolumns cssgradients no-cssreflections csstransforms csstransforms3d csstransitions fontface generatedcontent video audio localstorage sessionstorage webworkers applicationcache svg inlinesvg no-smil svgclippaths tablet windows windows8 windows8_1 64bit ie ie11 ie11_0 trident fr-ca flash java landscape">

So, my laptop is detected as a tablet. Did you find a way to solve this ? Thanks!

julianxhokaxhiu commented 9 years ago

Actually I've found this topic which it makes more sense to me. Probably that small snippet will help us to idenfity if we are on a Tablet or on a Touchable Laptop.

The only problem is that I don't have a Surface where to test it, but maybe you can: http://stackoverflow.com/a/27069503

Anyway my output for this:

window.navigator.pointerEnabled ? "pointer" : "ontouchstart" in window ? "touch" : "mouse";

is pointer

//EDIT: Based on this: https://msdn.microsoft.com/en-us/library/windows/apps/hh972607.aspx

I think we have to change the If to this:

window.PointerEvent ? "pointer" : "ontouchstart" in window ? "touch" : "mouse";

which anyway outputs pointer

rajchetan commented 9 years ago

that's great.

On Wed, Jun 24, 2015 at 2:57 PM, Julian Xhokaxhiu notifications@github.com wrote:

Actually I've found this topic which it makes more sense to me. Probably that small snippet will help us to idenfity if we are on a Tablet or on a Touchable Laptop.

The only problem is that I don't have a Surface where to test it, but maybe you can: http://stackoverflow.com/a/27069503

Anyway my output for this:

this.touchType = window.navigator.pointerEnabled ? "pointer" : "ontouchstart" in window ? "touch" : "mouse";

is pointer

— Reply to this email directly or view it on GitHub https://github.com/barisaydinoglu/Detectizr/issues/28#issuecomment-114803215 .

Chetan