美文网首页
js判断iPhone手机是否是有下横线的型号

js判断iPhone手机是否是有下横线的型号

作者: 鲜蛋卷小狐狸 | 来源:发表于2021-08-17 10:17 被阅读0次
var u = navigator.userAgent;
        var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
        if (isIOS && screen.height == 812 && screen.width == 375) {
          //是iphoneX
          console.log('是iphonex')
          return true;
        } else if (screen.height == 896 && screen.width == 414) {
          console.log('是iphonex')
          return true;
        } else {
          //不是iphoneX
          console.log('不是iphonex')
          return false;
        }

相关文章

网友评论

      本文标题:js判断iPhone手机是否是有下横线的型号

      本文链接:https://www.haomeiwen.com/subject/bafgbltx.html