In ios, the horizontal screen and then the vertical screen back to the style are all deformed, I can add an alert, how can it be feasible without adding alert? Or simply prohibit the horizontal screen.

in ios, the horizontal screen and then back to the vertical style are all deformed, I can add an alert, how can it be feasible without adding alert? Or directly prohibit horizontal screen

normal page:

clipboard.png

clipboard.png

alert

clipboard.png

console.log()

clipboard.png

window.onorientationchange=function(){
   if(window.orientation==90||window.orientation==-90){
       alert("");
    }else{
       alert("");
   }
 }

Question1: why can I just write alert? Why not write console?
question 2: is it possible to disable the horizontal screen directly?

Mar.14,2021

may be a problem with dom . Try scrolling 1px


<meta name="screen-orientation" content="portrait">
<meta name="x5-orientation" content="portrait">

it seems to be invalid in Wechat's official account


change the height of the page after the screen switch is detected, trigger the re-rendering of the page, or reload

Menu