views:

2020

answers:

2

hi, i need to hide the URL bar in ipod touch when the web applcation loaded, i tried all the possible solutions found online including the one found here: http://www.iphonemicrosites.com/tutorials/how-to-hide-the-address-bar-in-mobilesafari/

and setting min-height in CSS, but it only works in landscape, and in profile mode, it only hide part of the URL bar not the whole bar. anyone has any idea? Thanks.

below is my code:

<meta name="app-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="apple-touch-fullscreen" content="YES" />
<meta name="viewport" content="width=320;initial-scale=0.6666;;minimum-scale=0.6666; maximun-scale=1.0;"/>


<title>Test</title>
<script type="application/x-javascript">

addEventListener("load", function()
{
    setTimeout(updateLayout, 0);
}, false);

var currentWidth = 0;

function updateLayout()
{
    if (window.innerWidth != currentWidth)
    {
        currentWidth = window.innerWidth;

        var orient = currentWidth == 320 ? "profile" : "landscape";
        document.body.setAttribute("orient", orient);
        setTimeout(function()
        {
            window.scrollTo(0, 1);
        }, 100);
    }
}

setInterval(updateLayout, 100);

</script>
<link media="only screen and (max-device-width: 320px)" href="style.css" rel="stylesheet" type="text/css" />

...

A: 

Have you tried iUI? http://code.google.com/p/iui/

The code you have seems like a selection of iUI just to make the page fullscreen, but I wonder if you have a specific reason not to use the complete script. I used it on one occasion and I didn't have to do anything else than adding the script to the pages.

Timothée Boucher
A: 

This did the trick for me:

<body onload="setTimeout(function() { window.scrollTo(0, 1) }, 100);">
Sam V