By default, it gets shown only when the device's menu button is pressed and when the page is swiped down (see the GIF below when the touch marker is red). Can the URL bar be shown using JavaScript?
Asked
Active
Viewed 2,309 times
3
-
The site is not scrolled down, but rather up? Btw I think it's more an edge swipe, not a typical scroll drag. – Bergi Jun 29 '14 at 22:00
-
Instead of "unhide", you'd better use the term "show" :-) – Bergi Jun 29 '14 at 22:02
-
@Bergi Thanks for the advice, I'm not a native speaker, still improving my english. ;) – Tamás Bolvári Jun 29 '14 at 22:17
-
@Bergi Sorry, I meant swiping not scrolling. – Tamás Bolvári Jun 29 '14 at 22:32
-
1Sorry I don't think you can without native code running on android. – Jegsar Jun 29 '14 at 22:45
2 Answers
2
The solution
It is possible only on user input, because of the limitations of the Full Screen API. See the demo.
var p;
function showURLBar() {
p = [window.pageXOffset, window.pageYOffset];
document.documentElement.webkitRequestFullscreen();
setTimeout(function () {
document.webkitExitFullscreen();
setTimeout(function () {
scrollTo(p[0], p[1]);
}, 300);
}, 300);
}
Important notes
- This function is tested only in Chrome 35.0.1916.141, on Samsung Galaxy S4, running Android 4.4.2.
- On other devices, it might be necessary to increase the timeouts.
- To avoid errors in other browsers, use a cross-browser implementation of the Full Screen API functions instead of webkit's.
- This is kind of a hack, so it might become ineffective in future releases of Chrome.
- Some lag can be seen because of the 600 ms timeout, but the function would be dysfunctional without it.
- I've checked some other approaches without success. Changing the entire URL using
window.location
makes the address bar reappear, but leaving/reloading the page is an undesirable side effect. Changing onlywindow.location.hash
or usingwindow.history
doesn't help either, even if the URL is modified. None ofwindow.scrollBy
,window.scrollTo
,window.scrollTop
helps.

Tamás Bolvári
- 2,976
- 6
- 34
- 57
-
1the year is 2017 and this is still an issue and this is still the only solution I could find. Thanks so much for this! – lupos Aug 09 '17 at 19:20
0
By the use of the word 'device' I'm guessing you mean a mobile device. I fought with this also and just used a shortcut to the page from the desktop of the device. Then you get full screen without the address bar.

user3594045
- 33
- 1
- 9