问题
How to restrict browser view to Landscape on a mobile browser in HTML5? On potrait view, it should display "Switch to landscape mode" and load when it is turned to landscape mode.
回答1:
you can use the "onorientationchange" event of your browser. I extracted a working example from one of my testing projects: http://jsfiddle.net/r9b8D/
Its not exactly what you are looking for, but it shows the implementation of "onorientationchange". Copy the jsfiddle example to your host and navigate to the site with your mobile phone to see what happens - Maybe you can navigate to jsfiddle with your phone, i am not sure.
Feel free to modify the example to fit your needs.
来源:https://stackoverflow.com/questions/8292520/how-to-restrict-browser-view-to-landscape-on-a-mobile-browser-in-html5