/*
// META

Code Name
"Studio Hyperset JavaScript Function: Hiding the iPhone's URL Bar on Page Load"

Code URL
http://code.google.com/p/studio-hyperset

Author
Quimby Melton
SH Web Developer & Director of Operations
quimby@studiohyperset.com

SH Home
http://studiohyperset.com

SH Blog
http://studiohyperset.com/posts

Relevant Posts
http://studiohyperset.com/hiding-the-iphone-url-bar/2027

// DESCRIPTION
Having trouble tracking down a reliable way to hide the iPhone’s URL bar on page load, I cobbled together several sources. This is the most effective solution for hiding the iPhone’s URL bar on page load.
// VERSION
1.0

// TAGS
javascript, agent, browser, traffic, mobile, detection, apple, iphone, viewport, meta

// FUTURE BUILDS
- iPad functionality.

// CHANGELOG
1.0 (4/12/11) - Initial Google Code Project Hosting release

// INSTRUCTIONS
1) Upload the hide-iphone-address-bar-function.js script to your server. Make sure it's executable (chmod 755).

3) Enter the following in the <head> section of your site/page where "URL PATH TO hide-iphone-address-bar-function.js" is the relative/absolute URL path to the script on your server:

<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<script type="text/javascript" src="URL PATH TO hide-iphone-address-bar-function.js"></script>
4) Surf to your page using your iPhone, and see the script in action. 

Please note, if the page isn't long or wide enough to require scrolling, the URL bar will stay in place.

// SUPPORT
Feel like supporting SH? 

You can do so here: 

https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=C2KQADH2TGTS4
*/
if (navigator.userAgent.indexOf('iPhone') != -1) {
        addEventListener("load", function() {
                setTimeout(hideURLbar, 0);
        }, false);
}

function hideURLbar() {
        window.scrollTo(0, 0);
}
