是否可以防止 iPhone/iPad 方向在浏览器中更改?

Is it possible to prevent iPhone/iPad orientation changing in the browser?(是否可以防止 iPhone/iPad 方向在浏览器中更改?)
本文介绍了是否可以防止 iPhone/iPad 方向在浏览器中更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这个问题上看到过类似的问题,但它们与本机应用程序有关.我为 iPhone/iPad 构建在浏览器 (Safari) 中运行的网络应用程序.

I've seen similar questions on this issue, but they are related to native apps. I build web apps for the iPhone/iPad that run in the browser (Safari).

我想知道是否有办法防止浏览器中的方向改变,也许是通过一些元标记.我知道允许您指定缩放和缩放功能的视口元标记,因此认为方向可能有类似的东西.

I was wondering if there is a way to prevent orientation change in the browser, perhaps via some meta tag. I know of the viewport meta tag which allows you to specify scale and zooming capabilities, so figured maybe there is something similar for orientation.

我怀疑这是可能的,但我想我只是在这里提出一个问题来看看.

I doubt it is possible, but I thought I'd just pop a question on here to see.

推荐答案

似乎无法阻止方向改变,但您可以使用上面提到的代码进行检测.

It does not appear to be possible to prevent orientation change, but you can detect it with the code mentioned above.

如果您想阻止方向更改,您似乎需要使用 WebKit 构建一个本机应用程序来取消该事件.

If you want to prevent orientation change it appears as though you'll need to build a native app using WebKit which quashes the event.

这篇关于是否可以防止 iPhone/iPad 方向在浏览器中更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Pushing UIViewController above UITabBar(将UIView控制器推送到UITabBar上方)
java.lang.IllegalStateException: SimpleTypeImpl should not be created for error type(异常:不应为错误类型创建SimpleTypeImpl)
userContentController never called back from JS injection(用户内容控制器从未从JS注入回调)
Android IllegalArgumentException: The tag for fragment_XXX is invalid. Received: layout-sw600dp/fragment_XXX_0(Android IlLegalArgumentException:Fragment_XXX的标签无效。收到:Layout-sw600dp/Fragment_XXX_0)
iOS convert audio sample rate from 16 kHz to 8 kHz(IOS将音频采样率从16 kHz转换为8 kHz)
Enforcing an audio sampling rate in iOS(在iOS中强制音频采样率)