Safari and Chrome on mobile devices both include a visible address bar when a page loads. As the body
of the page scrolls, these browsers will scroll the addres
Have a look at this HTML5 rocks post - http://www.html5rocks.com/en/mobile/fullscreen/ basically you can use JS, or the Fullscreen API (better option IMO) or add some metadata to the head to indicate that the page is a webapp
I know this is old, but I have to add this in here..
And while this is not a full answer, it is an 'IN ADDITION TO'
The address bar will not disappear if you're NOT using https.
ALSO
If you are using https and the address bar still won't hide, you might have some https errors in your webpage (such as certain images being served from a non-https location.)
Hope this helps..
The easiest way to archive browser address bar hiding on page scroll is to add "display": "standalone",
to manifest.json
file.
In my case problem was in css and html layout.
Layout was something like html - body - root - ...
html and body was overflow: hidden
, and root was position: fixed, height: 100vh
.
Whith this layout browser tabs on mobile doesnt hide.
For solve this I delete overflow: hidden
from html and body and delete position: fixed
, height: 100vh
from root.
You can go to fullscreen when user allows it :)
<button id="goFS">Go fullscreen</button>
<script>
var goFS = document.getElementById("goFS");
goFS.addEventListener("click", function() {
const elem = document.documentElement;
if (elem.requestFullscreen) {elem.requestFullscreen()}
}, false);
</script>
This should be the code you need to hide the address bar:
window.addEventListener("load",function() {
setTimeout(function(){
// This hides the address bar:
window.scrollTo(0, 1);
}, 0);
});
Also nice looking Pokedex by the way! Hope this helps!