Last active
August 29, 2015 14:01
-
-
Save reacher-lu/4ee817fd076163206d5a to your computer and use it in GitHub Desktop.
UA 检测电脑与手机访问
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//平台、设备和操作系统 | |
var system ={ | |
win : false, | |
mac : false, | |
xll : false | |
}; | |
//检测平台 | |
var p = navigator.platform; | |
alert(p); | |
system.win = p.indexOf("Win") == 0; | |
system.mac = p.indexOf("Mac") == 0; | |
system.x11 = (p == "X11") || (p.indexOf("Linux") == 0); | |
//跳转语句 | |
if(system.win||system.mac||system.xll){ //转向电脑端 | |
window.location.href="reacher.lu"; | |
}else{ | |
window.location.href="m.reacher.lu"; //转向手机端} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment