<script language= "JavaScript" >
function Mobile_device_detect (URL)
{
var thisos=navigator.platform;
var os=new Array ("IPhone", "IPod", "IPad", "Android", "Nokia", "SymbianOS", "Symbian", "Windows phone", "Phone", "Linux ARMV71 "," MAUI "," untrusted/1.0 "," Windows CE "," BlackBerry "," Iemobile ");
for (Var i=0;i<os.length;i++)
{
if (Thisos.match (Os[i]))
{
Window.location=url;
}
}
Because quite a part of the cell phone system does not know the information, here is to do temporary special identification
if (navigator.platform.indexOf (' IPad ')! =-1)
{
Window.location=url;
}
This is partly because the core of the Android phone is also Linux
But navigator.platform display information is different, so from the browser, that is, using navigator.appversion information to make judgments
var check = navigator.appversion;
if (Check.match (/linux/i))
{
X11 is a platform for UC browsers and can be attached if other special browsers are available
if (Check.match (/mobile/i) | | check.match (/x11/i))
{
Window.location=url;
}
}
Class In_array function
Array.prototype.in_array = function (e)
{
for (i=0;i<this.length;i++)
{
if (this[i] = = e)
return true;
}
return false;
}
}
Mobile_device_detect ("http://m.baidu.com");
</script>
I found such a piece of code, but now can only be said mobile Access jump to Domin
JS to determine the phone-side access to jump to the mobile phone