【代码】判断手机端和电脑端自动跳转到各自的页面

爱讯自家使用的一段代码,用于判断手机端和电脑端自动跳转到相应的页面代码
判断手机端和电脑端自动跳转到各自的自动检测,并跳转至电脑端
<script type="text/javascript">
var system = {
win: false,
mac: false,
xll: false
};
var p = navigator.platform;
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 = "http://www.aixun.cc/vip";
} else {}
</script>自动检查客户端,跳转至移动端代码
<script type="text/javascript">
var mobileAgent = new Array("iphone", "ipod", "ipad", "android", "mobile", "blackberry", "webos", "incognito", "webmate", "bada", "nokia", "lg", "ucweb", "skyfire");
var browser = navigator.userAgent.toLowerCase();
var isMobile = false;
for (var i=0; i<mobileAgent.length; i++){ if (browser.indexOf(mobileAgent[i])!=-1){ isMobile = true;
//alert(mobileAgent[i]);
location.href = 'http://www.aixun.cc/mvip';
break; } }
</script>
标签: 收藏

