判断设备是PC端,还是移动端 var ua = navigator.userAgent.toLocaleLowerCase(); var pf = navigator.platform.toLocaleLowerCase(); var isAndroid = (/android/i).test(ua)||((/iPhone|iPod|iPad/i).test(ua) && (/linux/i).test(pf)) || (/ucweb.*linux/i.test(ua)); var isI…
var u = navigator.userAgent; var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端 var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端 alert('是否是Android:'+isAndroid); alert('是否是iOS:'+isiOS);…
$(function(){     // console.log(navigator.userAgent);     var os = function (){       var ua = navigator.userAgent,       isWindowsPhone = /(?:Windows Phone)/.test(ua),       isSymbian = /(?:SymbianOS)/.test(ua) || isWindowsPhone,       isAndroid = …
//判断是不是PC 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…
//判断是否是手机 function IsMobile() { var isMobile = { Android: function () { return navigator.userAgent.match(/Android/i) ? true : false; }, BlackBerry: function () { return navigator.userAgent.match(/BlackBerry/i) ? true : false; }, iOS: function () { re…
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>用indexOf判断设备是否是PC端?</title> </head> <body> <a href="javascript:;" id="J_checkplatformbtn">用indexOf判断设备是否是PC端?&l…
js判断当前设备 最近用bootstrap做自适应,发现仍然很难很好的兼容web端和PC端的现实. 仔细观察百度,淘宝,京东等大型网站,发现这些网站都有对应不同客户端的子站. 站点 PC端url web端url 百度 www.baidu.com m.baidu.com 淘宝 www.taobao.com m.taobao.com 京东 www.jd.com m.jd.com 网易 www.163.com 3g.163.com /*判断当前设备跳转到指定地址.PCurl:PC端地址:WebUel:…
$(document).ready(function () { /* 判断设备*/ var browser={ versions:function(){ var u = navigator.userAgent, app = navigator.appVersion; return { trident: u.indexOf('Trident') > -1, //IE内核 presto: u.indexOf('Presto') > -1, //opera内核 webKit: u.indexOf('…
$(function(){ if (!navigator.userAgent.match(/mobile/i)) { //PC端 }else{ //移动端 } })…
1. 判断浏览器是pc端还是手机端 <script type="text/javascript"> var browser = { versions: function() { var u = navigator.userAgent, app = navigator.appVersion; return { //移动终端浏览器版本信息 trident: u.indexOf(, //IE内核 presto: u.indexOf(, //opera内核 webKit: u.in…