Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Modernizr reporting laptop as touch device in Chrome and FF

Bit of a weird one. I have a site I am working on. But, on my laptop (ASUS Zenbook) some of the features do not work. We spent a good amount of time using Firebug to try and get it working/work out what it was, with no joy!

I then noticed that these features were actually created in CSS using :hover classes, but were also disabled for touch devices by including the class ".no-touch".

I then looked at the classes that Modernizr had added to the HTML tag and ".touch" had been added along with the standard.

So it seems, Modernizr is viewing my laptop, in Firefox and Chrome, as a touch device.

Obviously, this could be an issue for when the site goes live in that some features will not work for anyone using a Zenbook and any other devices that acts in the same way.

Has anyone seen anything like this before? Maybe with other "non-touch" devices?

like image 761
jamesmhaley Avatar asked Nov 23 '12 14:11

jamesmhaley


1 Answers

Unfortunately Modernizr tests for support of Touch-events in the browser, so it's not a proper test for a touch device. Last builds of Chrome and Firefox are supporting this feature.

You can check the issue here: https://github.com/Modernizr/Modernizr/issues/548

I'm searching for a good solution on this matter too, but the only thing I've found is this, though I haven't tested it out yet: https://stackoverflow.com/a/4819886/1262357

If you have good results please let me know!

like image 76
Gruber Avatar answered Nov 11 '22 11:11

Gruber