手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >手机平板等移动端适配跳转URL的js代码
手机平板等移动端适配跳转URL的js代码
摘要:复制代码代码如下: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>

【手机平板等移动端适配跳转URL的js代码】相关文章:

鼠标图片振动代码

Javascript随机显示图片的源代码

nextSibling

光标定位等TextRange的操作的范例代码

手机开发必备技巧:javascript及CSS功能代码分享

必须点击广告才能进入的代码

js脚本学习 比较实用的基础

深入浅出理解javaScript原型链

JavaScript基本语法讲解

网页里控制图片大小的相关代码

精品推荐
分类导航