brendanlim / mobile-fu

Automatically detect mobile requests from mobile devices in your Rails application.
http://www.intridea.com/2008/7/21/mobilize-your-rails-application-with-mobile-fu
MIT License
709 stars 195 forks source link

IE Browsers and False Positives #32

Open MaffooClock opened 11 years ago

MaffooClock commented 11 years ago

I've found that some IE browsers contain the string "Tablet PC" in their user-agent string, even though it's not a tablet. I believe this occurs in "Media Center" versions of Windows, and I think there might be reasons this can occur, too (thanks, Microsoft, for your utter brilliance).

An excellent example of this, along with some discussion, can be found here: http://webmasters.stackexchange.com/questions/28569/why-would-an-ie8-in-a-desktop-has-a-tablet-pc-2-0-in-its-user-agent-string

Mobile Fu needs to be modified so that if the UA contains both MSIE and "Tablet PC", then yield to desktop.

MaffooClock commented 11 years ago

Well, I just compared the regex with the UA string in my example link above, and there is no "Tablet" in the regex. Hmm, not sure which string IE is triggering Mobile Fu, but it does happen. I'll have to find a browser that's doing this and get the exact UA string.

yanhuiyi commented 11 years ago

I came across the same issue when I use categorizr.js, a client side device detection script written in JavaScript. It happened on some IE10/Windows7(32bit), which contains 'Tablet PC 2.0' string in UA, well doesn't have on others with the same version IE and OS.

http://www.zytrax.com/tech/web/msie-history.html lists updated IE UA history, you will find all UA with 'Tablet PC' but without categories on which version on which devices.

Not sure if you can fix by a RegExp something like:

ua.match(/tablet/i) && !ua.match(/tablet pc/i)

Any ideas?

benlangfeld commented 10 years ago

This project is abandoned. Please see the active fork at http://github.com/benlangfeld/mobile-fu. Please test with the released gem and master branch of the new home for the project, and file an issue on the other repo if you still have problems.

See #40.