是否是pc端、
function isPc() {var userAgentInfo = navigator.userAgent;var Agents = ["Android", "iPhone", "symbianOS", "Windows Phone", "iPad", "iPod"]var flag = true;for (var i = 0; i < Agents.length; i++) {if (userAgentInfo.indexOf(Agents[i]) > 0) {flag = falsebreak}}return flag}
是否是IOS
function isIOS() {var u = navigator.userAgent;if (u.indexOf("Android") > -1 || u.indexOf("Linux") > -1) {return false} else if (u.indexOf("iPhone") > -1) {return true} else if (u.indexOf('iPad') > -1) {return false} else if (u.indexOf('Windows Phone') > -1) {return false} else {return false}}
是否是IE
function isIEBrowser() {var ua = window.navigator.userAgentreturn !!ua.match(/compatible|MSIE|Trident/i)}
是否是移动端
function isDeviceMobile(){var ua = window.navigator.userAgentreturn /android|webos|iphone|ipod|balckberry/i.test(ua)}
是否是IE10浏览器
function isIE10(){var ua = window.navigator.userAgentreturn ua.indexOf('MSIE')>=0}
是否是IE11浏览器
function isIE11(){let ua = window.navigator.userAgent.toLocaleLowerCase();return ua.indexOf("rv:11")>-1&&ua.indexOf("trident")>-1;}
如果觉得《js判断当前是pc端 移动端 IE浏览器》对你有帮助,请点赞、收藏,并留下你的观点哦!