How to determine if a user is on a PC or mobile phone

I am working on a site and working on a component that will take users using wap or xhtml-mp and redirect them to sites specifically designed for those devices. Is there a good standard way of determining which of these users is using?

+1


source to share


4 answers


Because no matter what you do, sooner or later you will be wrong, each version of the site should contain a link to a page where the user can choose the appropriate format. Once they have selected, cookies are theirs, and if any, use that cookie as an override of what the user scent tells you.



In addition to user agent sniffing, if your site requires a login, you can keep this preference forever and reload it if necessary at login. If it's obvious from the user agent string, just use that, if it isn't, ask them to select from your list of available options and keep their default selection.

+5


source


There is always a User Agent string. But that means keeping up with all the latest browsers, and differentiating between them isn't always easy.



Instead of being redirected to a completely different page, try using the media selector in your stylesheets to tweak normal content for a smaller screen.

+3


source


Check this one and WURFL .

+2


source


+1


source







All Articles