Hello
How can I know if the user browsing my site is using his phone?, let’s say iPhone for example.
Regards
Hello
How can I know if the user browsing my site is using his phone?, let’s say iPhone for example.
Regards
As far as I know there is no real reliable way to do it, your best bet would be to to look at the user-agent supplied by the browser.
You can’t reliably. Here is how to ensure that your page is usable by as many visitors as possible.
[list][]Create your web page first using plain HTML so that the most relevant information is near the top.
[]Then use CSS to control the presentation (layout, styling, color, etc)
[*]Then use JavaScript to add behaviour to the page, and improve the usability of the page.[/list]
You can check the user agent string and compare it against a list of known mobile user agents. It’s not 100% bullet proof, but it’s pretty close. See for example: http://wurfl.sourceforge.net/nphp/
Thank you all for your responses.
zeez, I have to second that none of the methods that exist do a good job, user-agent strings aren’t reliable (many mobile devices allow their manipulation), and they cause a SERIOUS impact on your sites performance (in terms of server hits) because they usually involve checking against 1,000+ possible combinations. There’s far too many devices for it to be anything more than trying to swat flies with a corded computer mouse (as in useless).
Your best bet is to offer a mobile specific page (subdomains like m.yoursite.com work as the current convention), so then you can offer a more minimal, simplistic and less intensive experience for anyone who want’s something less bandwidth heavy version (check m.alistapart.com to see how it can be done well).