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

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

问题描述

我不相信有任何解决方案使用javascript / css / html以编程方式隐藏栏,但让我试着描述一个问题。我们是手机游戏开发团队,我们一直在开发游戏一年。

iOS 7发布后,我们面临隐藏导航栏不可行的问题。一旦用户点击Safari浏览器的上部或下部,导航栏再次出现并隐藏游戏的所有控件。



我们目前找到的唯一解决方案正在迫使用户:


  1. 旋转设备

  2. 滚动页面

  3. 将应用程序添加到主屏幕

这些替代方法都不可接受。它看起来像Apple知道这个问题,但一直忽略它。他们已经关闭了一个报告错误,作为bug#14076889的重复。



我相信我们不是唯一遇到同样问题的团队。有人知道这个解决方案吗?解决方案

-ui 功能
除了依赖默认的浏览器行为(条形图在滚动时将隐藏,但只有在滚动条时才会隐藏),再次无法移除/隐藏导航条元素是页面的 BODY )。唯一的解决方法是将应用程序保存到主屏幕并设置适当的元标记(见下文)。



2014年8月更新:iOS 8 beta)不再支持 minimal-ui
没有解决方法。 (其原因可能是由于网站滥用它来阻止人们离开,因此iOS 8 Safari中可能会有一些新功能尚未公开,并将最小化)



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

 < meta name =viewportcontent =minimal-ui> 

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



请注意,iOS 7.0.x上的,没有API或已知的解决方法为了这。在这些版本中,如果要永久隐藏Safari的浏览器镶边,则需要让用户将Web应用程序添加到主屏幕(使用适当的元标记设置< meta name =apple- Mobile-web-app-capablecontent =yes> )或使用某种类型的本机应用程序包装器(如Phonegap)并通过App Store分发。 $ b

就我个人而言,我希望他们没有删除iOS 6 Mobile Safari上横向模式下推出的全屏按钮,这是一个让开发人员和用户满意的绝佳解决方案。



完美的解决方案是让Mobile Safari支持HTML5全屏API(OS X上的Safari支持!)。唉,目前还没有支持,历史上iOS版本的发布并没有增加新的Safari功能,所以也许这是iOS 8的特色。


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.

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. Rotate device
  2. Scroll the page
  3. Add application to Home-screen

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?

解决方案

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).

Update August 2014: iOS 8 (beta) no longer supports minimal-ui. There's no workaround. (The reason for this is likely due to abuse by websites that used it to try to prevent people from navigating away, tho there may be new features in iOS 8 Safari that have not been made public yet that replace minimal-ui.)

iOS 7.1 added a new API to solve this problem:

<meta name="viewport" content="minimal-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.

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.

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.

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.

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

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