无法在 iPhone/iPod touch 的 Safari iOS 7 中隐藏导航栏 [英] Impossible to hide navigation bars in Safari iOS 7 for iPhone/iPod touch

查看:22
本文介绍了无法在 iPhone/iPod touch 的 Safari iOS 7 中隐藏导航栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不相信有任何解决方案可以使用 javascript/css/html 以编程方式隐藏栏,但让我尝试描述一个问题.我们是移动游戏开发团队,我们已经开发了一年的游戏.

I don't believe there is any solution to hide bars programmatically using javascript/css/html, but let me try to describe a problem. We are the team of mobile game developers and we have been developing a game for one year.

iOS 7 发布后,我们遇到了无法隐藏导航栏的问题.一旦用户点击 Safari 浏览器的上部或下部,导航栏就会再次出现并隐藏游戏的所有控件.

After iOS 7 announcement we have faced the problem that it is IMPOSSIBLE to hide the navigation bars. Once user taps in the upper or lower part of the Safari browser, navigation bars are appearing again and hide all controls of the game.

目前我们找到的唯一解决方案是强制用户:

The only solution we have found so far is forcing user to:

  1. 旋转设备
  2. 滚动页面
  3. 将应用程序添加到主屏幕

这些替代方案均不可接受.苹果似乎意识到了这个问题,但一直无视它.他们已经关闭了一个报告的错误,作为错误 #14076889 的副本.

None of these alternatives is acceptable. It looks like Apple is aware of this problem, but keeps ignoring it. They have closed a reported bug as a duplicate of the bug #14076889.

我相信我们并不是唯一遇到同样问题的团队.有人知道解决办法吗?

I believe that we are not the only team who experience the same problem. Does anyone know the solution?

推荐答案

2014 年 9 月更新:iOS 8 删除了 minimal-ui 功能除了依赖默认浏览器行为(滚动时导航栏将被隐藏,但仅当滚动元素是页面的 BODY 时),再没有办法删除/隐藏导航栏.唯一的解决方法"是将应用保存到主屏幕并设置正确的元标记(见下文).

Update September 2014: iOS 8 has removed the minimal-ui feature There's again no way to remove/hide navigation bars other than to rely on the default browser behavior (bars will be hidden when scrolling, but only if the scrolling element is the BODY of the page). The only "workaround" is to save the app to the homescreen and have the proper meta tags set (see below).

2014 年 8 月更新:iOS 8(测试版)不再支持 minimal-ui.没有解决方法.(其原因可能是由于网站滥用它来试图阻止人们导航,尽管 iOS 8 Safari 中可能有尚未公开的新功能取代 minimal-ui.)

iOS 7.1 添加了一个新的 API 来解决这个问题:

<meta name="viewport" content="minimal-ui">

默认情况下,这个新的视口标志会隐藏 Safari 用户界面(仅显示带有 URL 和 SSL 指示符的小标题栏).要访问 Safari UI,用户必须主动点击此标题栏.

This new viewport flag hides the Safari UI by default (only a small title bar with URL and SSL indicator are shown). To access the Safari UI, users must actively tap this title bar.

请注意,在 iOS 7.0.x 上,没有 API 或已知的解决方法.在这些版本中,如果您想永久隐藏 Safari 的浏览器 chrome,您需要让用户将 Web 应用程序添加到主屏幕(使用适当的元标记集 <meta name="apple-mobile-web-app-capable" content="yes">) 或使用某种本机应用程序包装器(如 Phonegap)并通过 App Store 分发.

Note that on iOS 7.0.x, there's no API or known workaround for this. In those versions, if you want to hide Safari's browser chrome permanently you need to either get the user to add the web app to the home screen (with the appropriate meta tags set <meta name="apple-mobile-web-app-capable" content="yes">) or use some sort of native app wrapper like Phonegap and distribute via the App Store.

就我个人而言,我希望他们没有删除他们在 iOS 6 Mobile Safari 上以横向模式引入的全屏"按钮,这是一个让开发人员和用户都满意的出色解决方案.

Personally, I wish they hadn't removed the "full screen" button they introduced in landscape mode on iOS 6 Mobile Safari, which was a great solution that made developers and users happy.

要更永久地解决这个问题,一个完美的候选者是 Mobile Safari 支持 HTML5 全屏 API(OS X 上的 Safari 支持!).唉,现在没有支持,而且从历史上看,iOS 点版本没有添加新的 Safari 功能,所以也许这适用于 iOS 8.

A perfect candidate for this to be solved more permanently would be for Mobile Safari to support the HTML5 full screen API (which is supported on Safari on OS X!). Alas, there's no support right now and historically iOS point releases didn't add new Safari features, so maybe that's something for iOS 8.

这篇关于无法在 iPhone/iPod touch 的 Safari iOS 7 中隐藏导航栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆