What is the most reliable way to determine whether the device accessing a site is a mobile device? There should also be a way to distinguish whether the device is a tablet or smartphone. A tablet can be 10 inches and therefore is capable of displaying a normal web page whereas a smartphone cannot and I want to deliver content specific to smartphones. I guess really what I should be checking is the screen resolution but I wasn’t able to find a reliable way of doing that. The screen resolution should be in pixels and not pixels per inch. So 320×480 or 480×600 and 600×800 would be considered by my site to be mobile. But something with 1024×768 probably should be considered a desktop.
Share
so here we go:
http://detectmobilebrowsers.com/ – here you have tool for detecting if your visitor is on mobile device. But …
http://modernizr.com/docs/#s2 – here you have tool to detect features. It’s way better to make some fallback by features than by mobile/desktop
http://www.w3.org/TR/css3-mediaqueries/ – here you have built in media queries that you can use to detect screen size. You can check that in action for example here: https://github.com/twitter/bootstrap/blob/master/less/responsive.less