【问题标题】:Is it possible to hide the address bar in Safari on iPhone?是否可以在 iPhone 上隐藏 Safari 中的地址栏?
【发布时间】:2016-05-16 19:58:04
【问题描述】:

我看到这在 iOS7 中是不可能的,但现在在 iOS9 中。可以用javascript隐藏地址栏吗?

我想为 iPhone 和 iPad 用户这样做。

谢谢!

【问题讨论】:

    标签: javascript ios iphone


    【解决方案1】:

    您可以在 Web App Manifest 中声明 display mode

    "display": "standalone"
    

    该应用程序的外观和感觉就像一个独立的应用程序。这可以包括具有不同窗口的应用程序、应用程序启动器中自己的图标等。在这种模式下,用户代理将排除用于控制导航的 UI 元素,但可以包括其他 UI 元素,例如状态栏。

    唯一的问题是用户必须先将您的网络应用添加到主屏幕。

    【讨论】:

    • 这将应用于什么元素? 2019 年还能用吗?
    【解决方案2】:

    这是您正在寻找的吗? http://pastebin.com/16s8Xvbw

    <!DOCTYPE html>
    <html>
    <head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=1">
    <style>
    body { height: 100vh; padding: 0; margin: 0; }
    div.content { height: 100%; }
    div.spacer { height: 1px; }
    </style>
    

    Stackoverflow 使用:Is it possible to hide URL bar in iOS 9 (Safari browser) by using JavaScript?

    【讨论】:

    • 似乎不是一个完美的解决方案,因为仅适用于横向,并且当从纵向翻转到横向时 - 如果用户以横向进入页面,他/她必须翻转到纵向并返回到横向。跨度>
    猜你喜欢
    • 2013-09-19
    • 1970-01-01
    • 1970-01-01
    • 2011-05-06
    • 1970-01-01
    • 2011-08-11
    • 2016-01-26
    • 1970-01-01
    相关资源
    最近更新 更多