https://www.jianshu.com/p/6224f429ce87
window.navigator.userAgent用来区分设备和浏览器
https://blog.csdn.net/liangyihe/article/details/78464656
window.navigator.userAgent.toLowerCase()用来区分设备和浏览器
var sUserAgent = window.navigator.userAgent.toLowerCase();
var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
var bIsMidp = sUserAgent.match(/midp/i) == "midp";
var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
var bIsAndroid = sUserAgent.match(/android/i) == "android";
var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM) {
window.location.href = "WapUI/Main.html";
}
else {
window.location.href = "WebUI/Main.html";
}
————————————————
版权声明:本文为CSDN博主「liangyihe」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/liangyihe/article/details/78464656