Meta Tag “apple-mobile-web-app-capable” for Android?

后端 未结 5 812
忘掉有多难
忘掉有多难 2020-12-23 21:21

Is there a way to create an Android Web Application like on the iPhone?

Using the \"apple-mobile-web-app-capable\" meta tag in the head element of an HTML page, it i

5条回答
  •  眼角桃花
    2020-12-23 21:47

    Use jQuery, you can see if the height of the content is greater than the viewport height. If not, then you can make it that height.

    $(document).ready(function() { 
      if (navigator.userAgent.match(/Android/i)) { 
        window.scrollTo(0,0); // reset in case prev not scrolled   
        var nPageH = $(document).height(); 
        var nViewH = window.outerHeight; 
        if (nViewH > nPageH) { 
          nViewH -= 250; 
          $('BODY').css('height',nViewH + 'px'); 
        } 
        window.scrollTo(0,1); 
      } 
    
    }); 
    

    Credit to meagar: Removing address bar from browser (to view on Android)

提交回复
热议问题