Detect whether the device, WeChat platform and app are installed
// 检测是否安装了APP var isappinstalled = (function () { return (location.search.indexOf("isappinstalled=1") !== -1); }()), // 检测ios设备 isIOS = (function () { return (navigator.userAgent.search(/iphone|ipad|ipod/i) !== -1); }()), // 检测微信平台 isWeiXin = (function () { return (navigator.userAgent.toLowerCase().indexOf("micromessenger") !== -1); }());
Distinguish between computers and handheld devices through device platforms
// 通过平台检测是否为PC端 var isPC = (function () { var system = { win: false, mac: false }; var p = navigator.platform; system.win = p.indexOf("Win32") === 0; system.mac = p.indexOf("Mac") === 0; // iphone ipad ipod 的平台检测为 IOS // 小米手机用的是Xll或Linux系统平台 // system.x11 = (p == “X11”) || (p.indexOf(“Linux”) == 0); if (system.win || system.mac) { return true; } else { return false; } }()); if (isPc) { // go to pc web } else { // go to mobile wap }
The above is the detailed content of About APP common tests. For more information, please follow other related articles on the PHP Chinese website!