function RedirectSmartphone(url) { if (url && url.length > 0 && IsSmartphone()) window.location = url; } function IsSmartphone() { if (DetectUagent("android")) return true; else if (DetectUagent("iphone")) return true; else if (DetectUagent("ipod")) return true; else if (DetectUagent("symbian")) return true; return false; } function DetectUagent(name) { var uagent = navigator.userAgent.toLowerCase(); if (uagent.search(name) > -1) return true; else return false; } RedirectSmartphone("http://mobile.version.com");