Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent Address-Bar hiding in mobile Browsers

I'm currently working on a website with a horizontal layout. All elements are position:absolute with javascript. Their size is calculated with window.innerHeight. My Problem is that despite the elements are no higher than the window's height, I can scroll down (height of the addressbar). This is annoying in two ways. First it triggers the window-resize event which I neither want nor need at that time. And Second it does not play well with some content boxes whose content should be scrollable vertically. Sometime I can scroll the boxes, but sometimes the whole page is scrolled first (as said before: height of the addressbar). Is there any solution which would allow me to prevent this address-bar auto-hiding mechanism on all devices.

Thank in advance!

This is not scrollable at all:http://maxeffenberger.de/test.html

This can be scrolled horizontally (makes sense to see hidden content) BUT also vertically until the addressbar is hidden (makes no sense, as there is no additional "vertical" content that would need more space: http://maxeffenberger.de/test2.html

like image 694
Max Effenberger Avatar asked Aug 05 '13 14:08

Max Effenberger


People also ask

How do I make the URL bar not disappear?

The F11 key turns Full Screen Mode on or off.

How do I hide mobile browser in address bar?

To get started enter “about:flags” into the Address Bar and hit Enter. Scroll down until you see the listing for Compact Navigation. Enable it and let the browser restart to gain access to the feature. Once the browser has restarted right click on one of the tabs and select Hide the toolbar from the Context Menu.

Where is address bar in mobile?

The address bar is displayed on top of the navigation controls and buttons for managing tabs, sharing, and other app settings.

Can I hide URL in address bar?

No you can't. Imagine spoofing https://yourbank.com/ instead of http://fakesite.com/ . The only way to see a different URL is to proxy the response, or putting it in a frame. The only way to "hide" your URL would be to use frames.


3 Answers

This is the way I have achieved it:

html {
  background-color: red;
  overflow: hidden;
  width: 100%;
}

body {
  height: 100%;
  position: fixed;
  /* prevent overscroll bounce*/
  background-color: lightgreen;
  overflow-y: scroll;
  -webkit-overflow-scrolling: touch;
  /* iOS velocity scrolling */
}
like image 101
Submachine23 Avatar answered Oct 27 '22 23:10

Submachine23


Use this style code on your page.Now your chrome url bar will not hide.It'll stop scrolling.

<style type="text/css">
  html, body {margin: 0; height: 100%; overflow: hidden}
</style>
like image 38
Nitesh S Chauhan Avatar answered Oct 27 '22 21:10

Nitesh S Chauhan


The only soltuion that worked for me was this :

Put the content of your body inside a wrapper with the following style :


.wrapper {
    position: absolute;
    top: 0.5px;
    left: 0;
    right: 0;
    bottom: 0.5px;
    overflow-x: hidden; /* or any other value */
    overflow-y: auto; /* or any other value */
}

the half-pixel offsets will be invisible but they will prevent the body from being considered as scrollable by the browser, thus preventing the address bar from hiding.

like image 5
ktorbo Avatar answered Oct 27 '22 21:10

ktorbo