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 setup for those devices. Is there a good standard way of detecting which of these the user is using?
-
There's always the User Agent string. But that means keeping up with all the latest browsers, and differentiating between them isn't always simple.
Instead of redirecting to a completely different page, try using a media selector in your style sheets to tweak your normal content for the smaller screen.
Tanerax : Its not quite the look we are switching them to a different version of the site its more the data viewed, and formatted. -
Because no matter what you do you WILL get it wrong sooner or later, each version of the site should include a link to a page where the user can choose an appropriate format. Once they chose, cookie them and, if present, use that cookie as an override to whatever user-agent sniffing would have told you.
In addition to user agent sniffing if your site involves logging in you can store that preference permanently and re-cookie them, if needed, upon login. If it's obvious from the user agent string just use that, if it's not, ask them to choose from a list of your available options and store their choice as the default.
0 comments:
Post a Comment