javascript判断是不是PC端打开
2017-07-03 本文已影响0人
Author_z
首先我们需要了解一下Navigator.userAgent


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'
}
只能想到这么多了,如果有大牛有更好的办法请告知!跪谢!!