Hey, I am trying to redirect all mobile(cell) phones that visit my site to http://m.domain.tld/ I am using <script type="text/javascript"> if ((navigator.userAgent.indexOf('iPhone') != -1) || (navigator.userAgent.indexOf('iPod') != -1)) { document.location = "http://m.domain.tld/"; } </script> HTML: to redirect iPhones & iPods too http://m.domain.tld/ How can i set it to do the same with: Apple iPhone Apple iPod HTC Droid BlackBerry HTC Evo Palm HTC Nexus One and more... Thanks,
What you have to do is to get the list of the "user agent" for the phone you want to redirect, as you have for "iphone" and "ipod". Like for Blackberry it is "blackberry" and put in the code as - navigator.userAgent.indexOf('blackberry') or navigator.userAgent.indexOf('android'). This will serve the job.