admin管理员组文章数量:1431704
I want to "lock" the orientation of the website to portrait mode in safari using pure javascript.
Let's say that I am building an application, I don't want users to be able to visit my app in landscape-mode. How do I do that?
Edit: I make the app in web-languages, I will assign it as a profile so anyone can download it on iPhone, so nothing with xCode or something.
I want to "lock" the orientation of the website to portrait mode in safari using pure javascript.
Let's say that I am building an application, I don't want users to be able to visit my app in landscape-mode. How do I do that?
Edit: I make the app in web-languages, I will assign it as a profile so anyone can download it on iPhone, so nothing with xCode or something.
Share Improve this question edited Sep 25, 2018 at 18:54 Samuel Hulla 7,1398 gold badges42 silver badges79 bronze badges asked Sep 25, 2018 at 18:43 codeWithMecodeWithMe 8922 gold badges12 silver badges17 bronze badges 5- Possible duplicate of Blocking device rotation on mobile web pages – Ruzihm Commented Sep 25, 2018 at 18:46
- Yeah well that did not work, and I require JavaScript only – codeWithMe Commented Sep 25, 2018 at 18:47
- Everything under Edit 2 is pure javascript. – Ruzihm Commented Sep 25, 2018 at 18:48
- Also, please edit your question to explain what happened in language more descriptive than "did not work". – Ruzihm Commented Sep 25, 2018 at 18:50
- It gave me 2-3 errors, I'm not with my puter at the moment but I will give them tomorow. – codeWithMe Commented Sep 25, 2018 at 19:50
1 Answer
Reset to default 1the screen.lockOrientation method is not supported by Safari, so you'll have to do feature detection.
For Safari, you might try the ponyfill: https://github./chmanie/o9n
版权声明:本文标题:mobile - How do I lock the screen orientation to portrait in Safari using plain JavaScript? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745582298a2664692.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论