如何在ipod touch中隐藏URL栏

Oha*_*ana 9 iphone mobile-safari

我需要在加载web applcation时隐藏ipod touch中的URL栏,我尝试了在线找到的所有可能的解决方案,包括在这里找到的解决方案:http: //www.iphonemicrosites.com/tutorials/how-to-hide-the-地址栏合mobilesafari /

并在CSS中设置min-height,但它仅适用于横向,在配置文件模式下,它只隐藏部分URL栏而不是整个栏.有谁有任何想法?谢谢.

下面是我的代码:

<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" />
Run Code Online (Sandbox Code Playgroud)

...

sam*_*tte 7

这对我有用:

<body onload="setTimeout(function() { window.scrollTo(0, 1) }, 100);">
Run Code Online (Sandbox Code Playgroud)


Tim*_*her 1

你试过iUI吗?http://code.google.com/p/iui/

您拥有的代码似乎是 iUI 的选择,只是为了使页面全屏显示,但我想知道您是否有特定的原因不使用完整的脚本。我曾经使用过它一次,除了将脚本添加到页面之外,我不需要做任何其他事情。