Hide address bar in mobile device browser

前端 未结 4 526
庸人自扰
庸人自扰 2020-12-29 05:15

I know 1 way of doing this.


...

But this works o

相关标签:
4条回答
  • 2020-12-29 05:23

    Just Add 'BR' at the end of the page. or you can use the jqueryUI with the div height 100%

    0 讨论(0)
  • 2020-12-29 05:27

    iPhone:

    Works only if the mobile "app" is added to the homescreen (through the plus-icon -> add to homescreen)

    <meta name="apple-mobile-web-app-capable" content="yes" />
    

    I have no experience with other mobile OS'es, but a quick Google-search for hide browser url bar android resulted in a similar solution to yours, with a window.scrollTo.

    0 讨论(0)
  • 2020-12-29 05:30

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

    Example:

    body { min-height:540px; }     
    body[orient="portrait"] { min-height:540px; }
    body[orient="landscape"] { min-height:400px; }
    
    0 讨论(0)
  • 2020-12-29 05:34

    from http://mobile.tutsplus.com/tutorials/mobile-web-apps/remove-address-bar/ I found

    function hideAddressBar() {
      if(!window.location.hash) {
        if(document.height < window.outerHeight)
          document.body.style.height = (window.outerHeight + 50) + 'px';
        setTimeout( function(){ 
            window.scrollTo(0, 1); 
            document.body.style.height = 'auto'; 
          }, 50 );
      }
    }
    

    A bit modified

    works quite well in some browsers, but at least I cannot get it to work Android Chrome.

    0 讨论(0)
提交回复
热议问题