如何隐藏iPhone上的地址栏? [英] How do I hide the address bar on iPhone?

查看:109
本文介绍了如何隐藏iPhone上的地址栏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何在iPhone上隐藏地址栏?



到目前为止,我尝试了两种不同的方法:


  • 使用JavaScript在页面加载时向下滚动一个像素技巧 以下元标记

     < meta name =viewportcontent =width = device-width; initial-scale = 1.0; maximum-scale = 1.0; user -scalable = 0; />< meta name =apple-mobile-web-app-capablecontent =yes/> 




此外:

 < meta names =apple-mobile-web-app-status-bar-stylecontent =black-translucent/> 

我完全困惑。

PS :哦,我忘了一件非常重要的事情:网页本身不会溢出浏览器窗口。这可能就是为什么1像素scrolldown技巧不起作用的原因。



我无法让它变得更大,因为关于设计的关键点在于每个人都可以滚动,但是这个页面会折叠...:)

解决方案

我自己打了这个。如果地址栏没有隐藏,原因可能只是页面不够长而无法滚动。





  window.scrollTo(0,1)

被称为页面必须长于窗口,因此可能发生滚动事件。



只有当滚动发生时,移动Safari才会隐藏地址栏。


How do I hide the address bar on iPhone?

I tried two different methods so far:

  • The scroll down one pixel trick with JavaScript on page load

  • And the following meta tags:

    <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" /><meta name="apple-mobile-web-app-capable" content="yes" />
    

Also this:

<meta names="apple-mobile-web-app-status-bar-style" content="black-translucent" />

I am completely confused.

PS: Oh, I forgot a really important thing: the web page itself does not overflow the browser window. It probably is the reason why the 1 pixel scrolldown trick does not work.

I can't make it bigger, since the hit thing about the design, that everyone can scroll, but this page folds... :)

解决方案

I just hit this myself. If the address bar is not hiding, the reason may simply be the page is not long enough to scroll.

When the

window.scrollTo(0,1)

is called the page MUST be longer than the window so a scrolling event can occur.

Only when the scrolling even occurs will mobile safari hide the address bar.

这篇关于如何隐藏iPhone上的地址栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆