原文:https://blog.csdn.net/wangshu696/article/details/43196349
<meta name="screen-orientation" content="portrait"><!-- uc强制竖屏 -->
<meta name="x5-orientation" content="portrait"><!-- QQ强制竖屏 -->
代码:
window.addEventListener("onorientationchange" in window ? "orientationchange" : "resize", hengshuping, false);
function hengshuping() {
if (window.orientation == 90 || window.orientation == -90) {
//横屏
} else {
//竖屏
}
}