在 chrome (android) 上隐藏移动浏览器地址栏 [英] hide mobile browser address bar on chrome (android)

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

问题描述

我们有一个网站,其中有一个简单的 JavaScript

We have a site, where with a simple JavaScript

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

我们在大多数浏览器(safari 和原生 android 浏览器)上隐藏了地址栏,这行 JavaScript 对大多数人都适用,但我们注意到 chrome 上的一个奇怪行为,页面确实向下滚动,但地址栏没有别躲!页面加载后,如果用户手指向下滚动一点,地址栏会正常隐藏.

We hide the address bar on most browsers (safari, and the native android browser) this line of JavaScript works fine for most, but we have noticed a strange behavior on chrome, the page indeed scroll down, but the address bar doesn't hide! After the loading of the page, if the user scrolls down a little bit with the finger, the address bar hides normally.

我也试过用JS向下滚动所有页面,结果页面完全滚动,地址栏仍然可见...

I have also tried to scroll down all the page with the JS, with the result of the page full scrolled, and the address bar is still visible...

有谁知道我是否忘记使用某些技巧,或者 Chrome 中根本不存在此功能?

Anyone knows if there is some trick I forgot to use, or if this function is simply not present in Chrome?

推荐答案

scrollTo(0,1) 在 Android 版 Chrome 中尚不支持(最近添加然后删除).我们确实有 FullScreen API,但这对于您想要实现的目标来说有点繁重.

scrollTo(0,1) is not yet supported in Chrome for Android (it was recently added and then removed). We do have the FullScreen API but that is a little heavy handed for what you want to achieve.

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

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