Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Impossible to hide navigation bars in Safari iOS 7 for iPhone/iPod touch

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?

like image 600
Anton Sinelnyk Avatar asked Sep 13 '13 18:09

Anton Sinelnyk


People also ask

How do I make the top bar of Safari disappear?

On your Mac, do any of the following in an app: Hide or show the toolbar: Choose View > Hide Toolbar or View > Show Toolbar.

How do I hide the top bar in Safari on IPAD?

In Settings, scroll down through the sidebar and tap “Safari.” In Safari settings, swipe upward until you locate the “Tabs” section. Tap the switch beside “Show Tab Bar” to turn it off.

How do I hide the address bar on my iPhone?

You can also temporarily hide it by just swiping the toolbar down. Or you can scroll down. If you're at the bottom of the page, you can still swipe up on the page (you can perform a scroll-down gesture) and the toolbar will hide temporarily.


3 Answers

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.

like image 122
thomasfuchs Avatar answered Oct 13 '22 20:10

thomasfuchs


UPDATE: There is a meta property for fixing this currently in iOS7.1 Beta according to this forum post on the release notes.

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

I have run a test and can confirm this feature is currently in Beta 2.

like image 17
Mark Avatar answered Oct 13 '22 21:10

Mark


NOTE: The new minimal-ui option is a great solution but it needs to be part of the HTML response. I tried on iOS7.1 beta3 to append the viewport meta tag with JS

$('head').append('<meta name="viewport" content="width=device-width, user-scalable=0, minimal-ui">');

the value "minimal-ui" is ignored by the browser.

like image 6
mex23 Avatar answered Oct 13 '22 20:10

mex23