js 判断设备是pc 还是 移动设备

2019-10-17  本文已影响0人  八妹sss

// 判断苹果、安卓、pc
if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) { //判断iPhone|iPad|iPod|iOS
  window.location.href ="iPhone.html";
} else if (/(Android)/i.test(navigator.userAgent)) {  //判断Android
  window.location.href ="Android.html";
} else { //pc
  window.location.href ="pc.html";
};

摘自:https://blog.csdn.net/qq_40542728/article/details/92652132

上一篇下一篇

猜你喜欢

热点阅读