function IsEquipment() {
  var flag = "PC";
  var userAgentInfo = navigator.userAgent;
  var Agents = [
                "Android",
                "iPhone",
                "SymbianOS",
                "Windows Phone",
                "iPad",
                "iPod"
                ];

  for (var v = 0; v < Agents.length; v++) {
    if (userAgentInfo.indexOf(Agents[v]) > 0) {
      flag = "Mobile";
      break;
    }
  }
  return flag;
}; 

获取当前设备,PC—电脑,Mobile—移动端。

03-05 16:39