h5判断是否为iphonex

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

转自https://blog.csdn.net/weixin_39924326/article/details/80352929

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){
            //是iphoneX
        }else{
            //不是iphoneX
        } 
    }
}

 

posted @ 2018-09-06 17:12  漠漠~  阅读(3204)  评论(0编辑  收藏  举报