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

2021-08-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;
        }
上一篇 下一篇

猜你喜欢

热点阅读