Target
I am developing an app that should stay in landscape mode on phone (always)
Code
Below is the code that I am doing to achieve it however its not working an I am getting the below error:
var locOrientation = screen.lockOrientation || screen.mozLockOrientation || screen.msLockOrientation || screen.orientation.lock;
locOrientation('landscape');
Error
Uncaught Error: The error you provided does not contain a stack trace.
You can achieve this effect by adding the desired orientation mode in your web app manifest.json
file:
{
"orientation": "landscape"
}
and then include it in head of your template:
<head>
<!-- ... -->
<link rel="manifest" href="./manifest.json">
</head>
You can learn more about web app manifest here
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.