uniapp超全user-agent判断 包括微信开发工具 hbuilder mac windows 安卓ios端及本地识别

//ua.js import $platform from '@/utils/platform.js'; let ua =""; // #ifdef H5 ua = window.navigator.userAgent.toLowerCase(); // #endif const isHbuilderx = ua.includes('hbuilderx'); //hb const isLocal = (() => { if ($platform === 'WXH5' || $platform === 'H5') { return location.hostname === 'localhost' || location.hostname.startsWith('192.168.') || location.hostname .startsWith('127.0.0.1'); } else { return false; } })(); const isWx = ua.includes('micromessenger'); //微信 const isWxDevtools = ua.includes('wechatdevtools'); //微信开发工具 const isWxH5 = isWx || isWxDevtools; //微信h5 const isMacWx = ua.includes('macwechat'); //mac微信 const isWinWx = ua.includes('windowswechat'); //windows微信 const isPcWechat = isWx && (isMacWx || isWinWx); //pc微信 const isWxMini = ua.includes('miniprogram'); //微信小程序 const isDingtalk = ua.includes('dingtalk'); //钉钉 const isSafari = ua.includes('safari'); //safari const isFirefox = ua.includes('firefox'); //火狐 const isWeibo = ua.includes('weibo'); //微博 const isQQ = ua.includes('qq'); //qq const isIphone = ua.includes('iphone'); //iphone const isIpad = ua.includes('ipad'); //ipad const isAndroid = ua.includes('android'); //安卓 const isIE = ua.includes('msie') || ua.includes('trident'); //ie export default { isWxH5, isLocal, isWx, isMacWx, isWinWx, isPcWechat, isWxMini, isDingtalk, isSafari, isFirefox, isWeibo, isQQ, isIphone, isIpad, isAndroid, isWxDevtools, isIE, isHbuilderx }
上一篇:C语言+电焊


下一篇:速盾:如何判断高防服务器的防御是否真实?