JavaScript 判断 iPhone X
2017-11-17 本文已影响0人
静候那一米阳光
if (navigator.userAgent.match(/(iPhone)/)) {
if ((screen.availHeight == 812) && (screen.availWidth == 375)) {
if ((window.innerHeight == "375") && (window.innerWidth == "812")) {// iPhone X Landscape 横屏
} else {// iPhone X Portrait 竖屏
}
}
}