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;
}







网友评论