js检测到如果是手机端就跳转到手机端的网址代码

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))&&window.location.href.indexOf("?mobile")<0)try{/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)?window.location.href="http://m.zfnet.net":/iPad/i.test(navigator.userAgent)||(window.location.href="http://m.zfnet.net")}catch(e){}

  

时间: 2024-08-08 05:32:19

js检测到如果是手机端就跳转到手机端的网址代码的相关文章

js判断手机端访问跳转到手机端

<SCRIPT LANGUAGE="JavaScript"> function mobile_device_detect(url) { var thisOS=navigator.platform; var os=new Array("iPhone","iPod","iPad","android","Nokia","SymbianOS","Symb

JS手机访问PC端网站自动跳转到手机端网站

<script type="text/javascript">//移动端url跳转,自定义部分开始    function mobile_device_detect(url) {        var thisOS = navigator.platform;        var os = new Array("iPhone", "iPod", "iPad", "android", "

手机访问网跳转到手机端

<script type="text/javascript" language="javascript"> var url = location.href; if (url.indexOf("pc") < 0) { var is_iPd = navigator.userAgent.match(/(iPad|iPod|iPhone)/i) != null; var is_mobi = navigator.userAgent.toL

JS前端开发判断是否是手机端并跳转操作(小结)

JS前端开发判断是否是手机端并跳转操作(小结) 这篇文章主要介绍了JS前端开发判断是否是手机端并跳转操作,非常不错,具有参考借鉴价值,需要的朋友可以参考下 常用跳转代码 ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 <script type="text/javascript">  // borwserR

通过JS检测360浏览器

如何通过JS检测360浏览器? 尝试了一大堆方法,网上大多数办法都是通过navigator.userAgent来判断,这可能在几年前是行得通的,现在360userAgent输出来跟谷歌除了版本号其余一模一样... 谷歌:      Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36 360极速:Mozilla/5.0 (Windo

JS检测移动端横竖屏的代码

这篇文章主要介绍了JS检测移动端横竖屏的代码,需要的朋友可以参考一下 使用media来判断屏幕宽度遇到的问题: ios上当我旋转屏幕的时候可行,但是安卓机上没反应,横屏显示的还是我竖屏的样式. 查了一下资料,css3的media如果要在移动端有较好的显示效果,需要在页头加上这段代码 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-s

如何用js检测判断时间日期的间距

<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>如何用js检测判断日期大于多少天</title> <script> window.onload=function(){ var ul1=document.getElementById("time"); var span1=ul1.getElementsByTag

通过js检测到iframe,使父窗口重定向到index -----------???----------------------

通过js检测到iframe,使父窗口重定向到index -----------???---------------------- 如果本身已将在iframe中,那么重定向的页面应该直接添加到父级iframe中-----???----

js检测服务器端Seesion是否存在

<script> window.onload = function () { var s_uname = '<% =Session["uname"] %>'; if (s_uname == "") { window.location.href = "../Login.aspx"; } } </script> js检测服务器端Seesion是否存在