//平台、设备和操作系统
var system = {
win: false,
mac: false,
xll: false,
ipad: false,
};
//检测平台(win系统,mac系统,Linux系统,ipad)
var p = navigator.platform;
system.win = p.indexOf("Win") == 0;
system.mac = p.indexOf("Mac") == 0;
system.x11 = p == "X11" || p.indexOf("Linux") == 0;
system.ipad = navigator.userAgent.match(/iPad/i) != null ? true : false;
//检测微信
var ua = navigator.userAgent.toLowerCase();
var isWeixin = ua.match(/MicroMessenger/i) == "micromessenger"
if (isWeixin) {//微信浏览器
// console.log("weixin");
} else {
if (system.win || system.mac || system.xll || system.ipad ) {
// console.log("pc");//pc
} else {
// console.log("mobile");//手机浏览器
}
}
最后
以上就是落后帽子最近收集整理的关于【uniapp】 判断浏览器环境的全部内容,更多相关【uniapp】内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复