iPhone - Hide Address Bar on Page Load


iPhone - Hide Address Bar on Page Load



I have a web page that is intended to be loaded on a person's iPhone. When the page is loaded, I want to hide the status and address bar that is at the top. I have seen other sites do this. In an attempt to accomplish this, I have placed the following code in the section of my web page:

<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=yes;" /> <script type="text/javascript">   function page_Load() {     setTimeout(function() { window.scrollTo(0, 1); }, 100);   } </script> 

The "page_Load" function is triggered through the onload event of the page's body element. Oddly, when the page loads, the status/title bar is hidden, however, not the address bar.

How do I hide both the status/title bar and the address bar when a web page loads?

Thank you!


Cocoa-touch - implementation files?

1:

Run javascript without UIWebView possible?
For those of you using jQuery here's an even simpler version:. Creating a Navigation View inside the standard Flipside view?
$('body').scrollTop(1); 
HTTP POST with custom header from iphone to PHP script. How do you read the header?indentationLevel property doesn't appear to do anything?

2:

How do I programatically pull lists/arrays of (itunes urls to) apps in the iphone app store?
Figured it out. iTune-style apps using C# It turns out my page needed to be "longer". how to remove subviews from scrollview?From a complete perspective, the sizing was correct, although I need to add a couple of pixels at the bottom. This hid the address bar as desired.. Thank you..

3:

A quick and dirty jQuery method....
$(function() {     function orientationChange(e) {         $("body").scrollTop(1);     }     $("body").css({ height: "+=300" }).scrollTop(1);     $(window).bind("orientationchange", orientationChange); }); 
This also hides the bar when a person changes their orientation (for the reason this it does become visible again normally). Just add this any where on your page and it'll automatically (regardless of 100% height/width/whatever) did what you seek. I have not measured the exact height of the address bar although it appears to be around 70px. I put 300 there just to ensure it works..


76 out of 100 based on 51 user ratings 986 reviews