js判断PC端还是移动端

function goPAGE() {
                if ((navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i))) {
                    /*window.location.href="你的手机版地址";*/
                    alert("mobile")
                }
                else {
                    /*window.location.href="你的电脑版地址";    */
                    alert("pc")
                }
            }
            goPAGE();
时间: 2024-10-09 23:02:04

js判断PC端还是移动端的相关文章

js判断游览器是移动端还是PC端

js判断网页游览器是移动端还是PC端 1 <script type="text/javascript"> 2 function browserRedirect() { 3 var sUserAgent = navigator.userAgent.toLowerCase(); 4 var bIsIpad = sUserAgent.match(/ipad/i) == "ipad"; 5 var bIsIphoneOs = sUserAgent.match(/

JS判断PC还是移动端打开网页

最近在做移动端网站,也需兼容PC端.还没找到更好的方法,只能用javascr判断用户是在PC端打开还是移动端打开. JS判断 var isPC = function (){    var userAgentInfo = navigator.userAgent.toLowerCase();    var Agents = new Array("android", "iphone", "symbianOS", "windows phone&

js判断PC端还是手机端

if(/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) { window.location.href = "手机版网址"; } else { window.location.href = "PC端网址"; }   原文地址:https://www.cnblogs.com/go-wandering/p/8658566.html

js判断PC端和移动端

var sUserAgent = window.navigator.userAgent.toLowerCase();//获取浏览器信息 var bIsIpad = sUserAgent.match(/ipad/i) == "ipad"; //ipadvar bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";//iphone var bIsMidp = sUserAgent.match(/midp/

JS判断手机访问还是电脑端访问

记录一下~~~~~~ <script type="text/javascript"> (function(){ if (/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) { console.log('这是移动端'); }else{ console.log('这是PC端'); } }) </script> HTML5中使用 tel: 在手机访问点击时,可直接调用拨号功能,get有效

JS判断有无网络(移动端)

ar EventUtil = { addHandler: function (element, type, handler) { if (element.addEventListener) { element.addEventListener(type, handler, false); } else if (element.attachEvent) { element.attachEvent("on" + type, handler); } else { element["

JS判断是否来自手机移动端的访问,并跳转

var browserName_ = navigator.userAgent ; if(browserName_.indexOf("iPad")<0&&browserName_.indexOf("Windows NT")<0&&browserName_.indexOf("Macintosh")<0){ if(browserName_.indexOf("Linux")>0)

JS判断PC 手机端显示不同的内容

方法一: function goPAGE() { if ((navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i))) { window.location.href="手机版地址"; } } else

js判断移动端或是pc端

Js判断客户端是否为PC还是手持移动设备方法一 function IsPC(){ var userAgentInfo = navigator.userAgent; var Agents = new Array("Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"); var flag = true; for (