I do not know how to prevent rotation if it should run in Safari, and not in a native application with a built-in UIWebView interface.
While you cannot prevent rotation, you can compensate for this as follows:
- Rotation detection using updateorientation event
- In the event handler, find the current orientation using window.orientation. (e.g. 0, 90, -90, 180).
- Update the class of your element to reflect the current orientation, and use styles such as -webkit-transform: rotate (-90deg) to rotate your interface in the opposite direction.
- Use window.scrollTo (0, 1) if necessary; to scroll the address bar on the screen.
source
share