function check() { let browser = navigator.userAgent;//用户访问的类型 let phone = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];//移动端类型 let type = true; for (let i = 0; i < phone.length; i++) { if (browser.indexOf(phone[i]) > 0) {//判断是否包含手机类型 type = false; break; } } return type; } check();