3 ms·
Ask HN: What is the best way to detect mobile devices?
Hi HN Community,<p>I'm an experienced web-developer who is just trying to create websites that display well on any screen/device (Responsive design). I know of CSS Media Queries, U/A sniffing and Device Description repositories like WURFL.<p>Is there any other better way/technique to detect mobile devices <i>efficiently</i> ? I could use a Javascript solution, but that will not really let me find out info about legacy phones or phones with poor JS support. What do you use personally to detect mobile devices? Could you please share, so everyone will benefit from it?? :)<p>Thanks,
Neya
- itsprofitbaron 14y agoSince you're going for a responsive design, you should definitely look at the available screen real estate. The reason for this is because, it allows you to display your responsive design without worrying about not detecting new devices - which is why I personally believe trying to detect User Agent strings will become out of date. This article is pretty useful: http://www.html5rocks.com/en/mobile/mobifying/ http://www.html5rocks.com/en/mobile/mobifying/
- neya 14y agoThank you for the link, at a quick glance, it looks like it uses CSS Media Queries though? I'll have a look...thanks :)
- itsprofitbaron 14y agoYeah they use CSS Media queries, its the easiest method to detect them especially for a responsive design