防止 Safari/iPad 进入横向模式
我有一个适用于 iPad 的网站,我希望访问者只能以纵向方式查看该网站。 是否可以阻止 Safari/iPad 进入横向模式?
预先感谢您的回复。
干杯, 罗伯特
I have a website for iPad and I want visitors to see it in portrait only.
Is it possible to prevent Safari/iPad to go in landscape mode?
Thanks in advance for your replies.
Cheers,
Robert
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是不可能阻止的。这是浏览器功能,无法使用 JavaScript 进行控制。
It’s not possible to prevent this. It’s a browser feature, and this cannot be controlled using JavaScript.
每个人都说你做不到这一点,但你可以黑客攻击它。我不建议除非你真的必须这样做,但你可以使用js来检测方向变化,并在该变化后使用css3将整个包装器div旋转90度(transform:rotate)
Everyone says you can't do this, but you can hackity hack it. I do not advise unless you really have to, but you could use js to detect orientation change, and upon that change use css3 to rotate a full wrapper div 90 degrees ( transform: rotate )