UA判断跳转

<script type="text/javascript">
UA = navigator.userAgent.toLowerCase();
url = window.location;
url = url.toString();
if ((UA.indexOf('iphone') != -1 || UA.indexOf('mobile') != -1 || UA.indexOf('android') != -1 || UA.indexOf('ipad') != -1 || UA.indexOf('windows ce') != -1 || UA.indexOf('ipod') != -1) && UA.indexOf('ipod') == -1) {
if (url.indexOf("m.") < 0) {
if (url.indexOf("www.") < 0){
var index = url.indexOf("http://");
if (index < 0){
url = "m." + url;
}else{
url = url.replace("http://", "http://m.");
}
}else{
url = url.replace("www.", "m.");
}
Go(url);
}
}
function Go(url) {
window.location = url;
}
</script>

如IE浏览器

http://www.hiry.net进口商品网站

上一篇:.NET CORE MYSQL 微信小程序 HTTPS 随笔


下一篇:vscode小程序代码高亮