let userAgentInfo = navigator.userAgent;
let Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone","iPad", "iPod"];
let isPC = true;
for (let i = 0; i < Agents.length; i++) {
if (userAgentInfo.indexOf(Agents[i]) > 0) {
isPC = false; break;
}
}
if (isPC) {
console.log('PC访问');
} else {
console.log('移动设备访问');
}
How to determine whether PC access or mobile access is done through js
Guess you like
Origin blog.csdn.net/weirdo_world/article/details/130942437
Recommended
Ranking