手机平板等移动端适配跳转URL的js代码_Javascript教程-查字典教程网
手机平板等移动端适配跳转URL的js代码
手机平板等移动端适配跳转URL的js代码
发布时间:2016-12-30 来源:查字典编辑
摘要:复制代码代码如下:if(/AppleWebKit.*mobile/i.test(navigator.userAgent)||(/MIDP|S...

复制代码 代码如下:

<script type="text/javascript">

if(/AppleWebKit.*mobile/i.test(navigator.userAgent) || (/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent))){

if(window.location.href.indexOf("?mobile")<0){

try{

if(/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){

window.location.href="手机页面";

}else if(/iPad/i.test(navigator.userAgent)){

window.location.href="平板页面";

}else{

window.location.href="其他移动端页面"

}

}catch(e){}

}

}

</script>

相关阅读
推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
  • 大家都在看
  • 小编推荐
  • 猜你喜欢
  • 最新Javascript教程学习
    热门Javascript教程学习
    编程开发子分类