js判断当前是什么设备(安卓 or ios or PC)

js判断当前是什么设备(安卓 or ios or PC),第1张

 if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
      console.dir(navigator.userAgent)
      this.phoneType = '苹果系统'
    } else if (/(Android)/i.test(navigator.userAgent)) {
      this.phoneType = '安卓系统'
    } else {
      this.phoneType = 'PC电脑'
    };

判断是否在 微信浏览器运行

    var ua = navigator.userAgent.toLowerCase();
    if (ua.match(/MicroMessenger/i) == 'micromessenger') {
      this.isweChat = '微信'
    } else {
      this.isweChat = '浏览器'
    }

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/993757.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-21
下一篇 2022-05-21

发表评论

登录后才能评论

评论列表(0条)

保存