Get via App Store Read this post in our app!
Check out WURFL and build a 302 redirector for User-Agents that match its list of mobile browser user-agent strings.
I have published the last version of “Apache Mobile Filter”, this open source project has in the very first 8 months, more than 1100 downloads from sourceforge and I suppose the same from CPAN.
The Apache Mobile Filter permits you to access WURFL from any programming language, not just Java and php that is traditionally used for dynamic mobile web sites.
The module detects the mobile device and passes the WURFL capabilities on to the other web application as environment variables. It can also be used to resize pictures on the fly to adapt to the screen size of the mobile device. Attempt it and let me know your opinion.
I wrote a JS script called “redirection_mobile.js” to solve this issue. It detects the User Agent and redirects to a mobile version if you’re accessing a site from a mobile device.
In some case you want to redirect from a mobile device to a desktop version (like with a link “Go to the main site”), the script will treat that and once you finish your session, you’ll access to the mobile version again.
You can find the source code on github here https://github.com/sebarmeli/JS-Redirection-Mobile-Site and you can read more details in one of my article here:
perhaps if you list your code that is not working, more help could be provided.
if you’ve got php, User Agent detection works well in most circumstances.
A very similar question was asked and answered here:
Traditionally mobile devices have been detected by comparing the HTTP User-Agent header against a list of well known mobile UA strings. A novel treatment instead attempts to detect the presence of a desktop OS – anything which is found to not be a desktop OS must then be mobile.
This results in far less false positives.
I’ve written a post with sample code in Python here:
Detect whether a device is a desktop – if it is not then redirect to your mobile site!
Once you get your mobile subdomain set-up, be sure to refer to this article from A List Apart which describes how mobile devices react to the CSS attribute, media=”handheld”. Unluckily, not all react identically.