在 iOS 上的 Safari 中全屏打开网页

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16485919/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 23:32:49  来源:igfitidea点击:

Open webpage in fullscreen in Safari on iOS

javascriptiosmobile-safari

提问by Eric Herlitz

There is a fullscreen mode in Safari on iOS. Is it possible to activate this through javascript or similar?

iOS 上的 Safari 有全屏模式。是否可以通过 javascript 或类似方法激活它?

Thanks

谢谢

回答by Strille

No, there is no way to toggle the fullscreen mode in Safari on iOS using javascript.

不,无法使用 javascript 在 iOS 上的 Safari 中切换全屏模式。

In order for a web page to run in fullscreen mode, you need to add the following meta tag, and the page needs to be started from a bookmark on the home screen:

为了让网页在全屏模式下运行,您需要添加以下元标记,并且需要从主屏幕上的书签启动该页面:

<meta name="apple-mobile-web-app-capable" content="yes">

However, you candetect if the page is running in fullscreen mode or not with javascript using the read only property:

但是,您可以使用只读属性通过javascript检测页面是否以全屏模式运行:

window.navigator.standalone