We\'ve got an alternate version of out website ready for mobile devices. The content we serve is different and it works well.
What is the best way to detect which v
If you are looking to redirect to a mobile site using JavaScript, I noticed that WURFL also has a solution for that will allow you to do server side detection with JavaScript.
<script type='text/javascript' src="//wurfl.io/wurfl.js"></script>
you will be left with a JSON object that looks like:
{
"complete_device_name":"Apple iPhone 6",
"is_mobile":true,
"form_factor":"Smartphone"
}
You can then use this:
if (WURFL.is_mobile === true) {
window.location.replace("http://stackoverflow.com");
}
If the device doesn't support JS, it's better to consider a Server-side solution, and WURFL API can help towards that direction.
Sometimes we want to avoid issue with this kind of approach (such as a reverse proxy caches pages and don't let redirect to the mobile version) or we need a quick solution knowing that nowadays almost all recent devices support JS.
For this reason, I wrote a JS script called "redirection_mobile.js" that detects the User Agent of the browser and redirects to the mobile version of your site if you're accessing it 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 handle that and once you finish your session, you'll access to the mobile version again.
You can find the source code on github here http://github.com/sebarmeli/JS-Redirection-Mobile-Site and you can read more details in one of my article here:
http://blog.sebarmeli.com/2010/11/02/how-to-redirect-your-site-to-a-mobile-version-through-javascript/
Simple:
<link rel="alternate" media="handheld" href="WEBSITE HERE">
put that in the head section.
Agreeing with Skaffman, another device database is DeviceAtlas. You have to pay for this one though.