您好,欢迎访问一九零五行业门户网

关于APP常用检测

检测设备、微信平台和app是否安装
// 检测是否安装了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); }());
通过设备平台区分电脑和手持设备
// 通过平台检测是否为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 }
以上就是关于app常用检测的详细内容。
其它类似信息

推荐信息