in reply to Grabbing query string

Why attempt to identify mobile users? why not let them decide if they want the stripped down mobile site, or the full fat desktop site. I think it would be better if you setup an alternative URL for users who want the stripped down site such as: http://m.<yoursite>.com

That way users who are using fancy smartphones and tablets with large screens and fast data connections can choose to use the desktop site if they want to, while users on underpowered desktop computers on the end of slow dial up connections can use the mobile site to save on bandwith and site complexity.

Having said that, if you realy need to identify mobile browsers, then take a look at WURFL. It is a database of thousands of mobile browser user agent strings, with the properties of each device so you can taylor a site for screen size, JavaScript support etc.

There is a perl module Mobile::Wurfl to interface to WURFL though when I tried using it I found it did not have enough features. The author did not accept a patch I sent, so I ended up writing my own WURFL libary which my employer will not allow me to share.

Replies are listed 'Best First'.
Re^2: Grabbing query string
by htmanning (Friar) on Jan 31, 2011 at 19:14 UTC
    Thanks for the suggestions. We have a separate mobile site and I still give people the choice, but this is mainly for Twitter feeds. It's working. I got help from here:
    http://corz.org/serv/tricks/htaccess2.php
    If anyone else needs this I got it to work by doing this in the .htaccess:
    RewriteCond %{QUERY_STRING} ID=(.+) RewriteRule ^articles/(.*) http://www.site.com/cgi-bin/mobile.pl?$1 [Q +SA]
    It only forwards people who use mobile browsers and who click on a link that specifies an ID in the query string. Everyone else is routed normally. Thanks. Thanks for the help.