检测设备、微信平台和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常用检测的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号