标签:oid navig glin fun 操作 break user col indexof
1. 判断微信
function is_weixin() { var ua = window.navigator.userAgent.toLowerCase(); if (ua.match(/MicroMessenger/i) == ‘micromessenger‘) { return true; } else { return false; } }
2. 判断Andorid还是ios
$(function () { var u = navigator.userAgent, app = navigator.appVersion; var isAndroid = u.indexOf(‘Android‘) > -1 || u.indexOf(‘Linux‘) > -1; //g var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端 if (isAndroid) { //这个是安卓操作系统 } if (isIOS) { //这个是ios操作系统 } });
3. 判断PC
//如果返回的是false说明当前操作系统是手机端,如果返回的是true则说明当前的操作系统是电脑端 function IsPC() { var userAgentInfo = navigator.userAgent; var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"]; var flag = true; for (var v = 0; v < Agents.length; v++) { if (userAgentInfo.indexOf(Agents[v]) > 0) { flag = false; break; } } return flag; }
出处:https://www.cnblogs.com/zhuchenglin/p/7528250.html
标签:oid navig glin fun 操作 break user col indexof
原文地址:https://www.cnblogs.com/mengff/p/9648266.html