I'm building an app in the browser for the iPad and was wondering if it's possible to lock the orientation of the viewport? I've checked apple's documentation and the only thing I've found says orientation is read only:
I'm thinking this means that there is no way to lock the orientation in the browser. Anyone got any ideas?
I'm building an app in the browser for the iPad and was wondering if it's possible to lock the orientation of the viewport? I've checked apple's documentation and the only thing I've found says orientation is read only: https://developer.apple./documentation/webkitjs/domwindow/1632568-orientation
I'm thinking this means that there is no way to lock the orientation in the browser. Anyone got any ideas?
Share Improve this question edited May 5, 2018 at 14:15 Cœur 38.7k26 gold badges204 silver badges277 bronze badges asked Jul 10, 2010 at 4:19 Joe LongstreetJoe Longstreet 611 silver badge2 bronze badges 1- stackoverflow./questions/1207008/… – TMan Commented Feb 8, 2014 at 4:19
1 Answer
Reset to default 7No. I guess this would appear too restrictive to the user, so you can only detect UI orientation. The only way to lock the orientation would be the exterior switch on the side of the device.
See this answer for code to detect it. You could also just use window.orientation
to get it.
For my webapps, I simply have a popover-view that alerts the user to rotate their device when its orientation is not desirable. You might even consider two UI setups for different orientations for a more customizable experience.