首先我們需要了解一下Navigator.userAgent

image.png

image.png
windows的就不貼了
如果我們直接判斷userAgent是不是就好了???
先貼代碼試試咯!!
//獲取useragent
var UserAgent = navigator.userAgent;
var systemInfo = UserAgent.split('(')[1].split(";")[0];
if (systemInfo === "iPhone" || systemInfo === "Linux"){
console.log('phone')
}else{
window.location.href = '/isweb'
}
只能想到這么多了,如果有大牛有更好的辦法請(qǐng)告知!跪謝??!