📜  如何在js中找出用户是在手机上还是在电脑上? - Javascript代码示例

📅  最后修改于: 2022-03-11 15:02:03.580000             🧑  作者: Mango

代码示例1
if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)){
  // true for mobile device
  document.write("mobile device");
}else{
  // false for not mobile device
  document.write("not mobile device");
}