js移动端页面判断是否是iphoneX

js移动端页面判断是否是iphoneX

function isIPhoneX(fn){
    var u = navigator.userAgent;
    var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
    if (isIOS) {        
        if (screen.height == 812 && screen.width == 375){
            console.log('iponeX')
        }else{
          console.log('ipone')
        } 
    }else{
         console.log('安卓')
   }
}

你可能感兴趣的:(js,css)