在移动设备浏览器中隐藏地址栏 [英] Hide address bar in mobile device browser

查看:175
本文介绍了在移动设备浏览器中隐藏地址栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这样做的一种方式。

I know 1 way of doing this.

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

但是,只有当页面大到足以滚动时,这才有效。如果页面适合屏幕上述功能不工作。在这种情况下如何隐藏地址栏?

But this works only if the page is big enough to be scrolled. If the page fits the screen the above function wont work. How to hide the address bar in this case ? I need to get it to work with iphone, ipad, android devices.

推荐答案

也许你可以设置minheight在身体更大。 480像素在垂直模式下的屏幕高度+ 60像素地址栏高度= 540像素。

Maybe you can set the minheight on the body bigger. 480px screen height in vertical mode + 60px address bar height = 540px.

示例:

body { min-height:540px; }     
body[orient="portrait"] { min-height:540px; }
body[orient="landscape"] { min-height:400px; }

这篇关于在移动设备浏览器中隐藏地址栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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