做网站首页制作手机端浏览的跳转

时间:2014-05-09 01:20:18   收藏:0   阅读:299

<script language="javascript"> 

if(!IsPC()){

window.location.href="/m/";   //要跳转的地址,也可以跳转到 window.location.href="http://m.xxx.com/";
}
function IsPC()
{
var userAgentInfo = navigator.userAgent;  
var Agents = new Array("Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod");  
var flag = true;  
for (var v = 0; v < Agents.length; v++) {  
if (userAgentInfo.indexOf(Agents[v]) > 0) { flag = false; break; }  
}
        return flag;  

}

</script>


做网站首页制作手机端浏览的跳转,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!