首页 > 代码库 > js 检查是否为手机端

js 检查是否为手机端

let isMobile = function(){            let userAgentInfo = navigator.userAgent;            let Agents = new Array("Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod")            let flag = false;            for (let v = 0; v < Agents.length; v++) {                if (userAgentInfo.indexOf(Agents[v]) > 0) { flag = true; break; }            };            return flag; }();

 

js 检查是否为手机端