js编写 电脑/手机端
作者:互联网
var sUserAgent = navigator.userAgent.toLowerCase();
var bIsIpad = sUserAgent.match(/ipad/i) == “ipad”;
var bIsIphoneOs = sUserAgent.match(/iphone os/i) == “iphone os”;
var bIsMidp = sUserAgent.match(/midp/i) == “midp”;
var bIsUc7 = sUserAgent.match(/rv:192.168.3.51:8081/i) == “rv:192.168.3.51:8081”;
var bIsUc = sUserAgent.match(/ucweb/i) == “ucweb”;
var bIsAndroid = sUserAgent.match(/android/i) == “android”;
var bIsCE = sUserAgent.match(/windows ce/i) == “windows ce”;
var bIsWM = sUserAgent.match(/windows mobile/i) == “windows mobile”;
if (!(bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM)) {
alert("当前是电脑打开")
} else {
alert("当前是手机打开")
}
电脑手机
标签:bIsUc,3.51,windows,sUserAgent,电脑,js,var,编写,match 来源: https://blog.csdn.net/qq_51408015/article/details/115459160