发布网友 发布时间:2022-04-22 05:46
共2个回答
热心网友 时间:2022-07-11 02:33
应该把JS 放在页面首页加载 就行
function IsPC() {
var userAgentInfo = navigator.userAgent;
var Agents = ["Android", "iPhone",
"SymbianOS", "Windows Phone",
"iPad", "iPod"];
var flag = true;
for (var v = 0; v < Agents.length; v++) {
if (userAgentInfo.indexOf(Agents[v]) > 0) {
flag = false;
break;
}
}
return flag;
}
var flag = IsPC(); //true为PC端,false为手机端
alert(flag);
热心网友 时间:2022-07-11 02:33
navigator.platform或者navigator.userAgent