1, a lot of information said, add the following code, you can hide the address bar, but I tried many times, seemingly unsuccessful AH.
Copy Code code as follows:
<meta name= "apple-mobile-web-app-capable" content= "yes"/>
2, we can use another way to hide the address bar. Scrolling through the window after the page is loaded, this really works, the only thing to note is that the page height must be high enough, the core code is as follows:
Copy Code code as follows:
<script type= "Text/javascript" >
AddEventListener ("Load", function () {settimeout (Hideurlbar, 0);}, False);
function Hideurlbar () {
Window.scrollto (0,1);
}
</script>
3, but when the page Height Adaptive window (height:100%), the above method does not apply, we need to adopt a special method:
Copy Code code as follows:
$ (' div '). css ("height", window.innerheight+100); Force content to exceed
Window.scrollto (0, 1);
$ ("div"). CSS ("height", window.innerheight); Reset to new height
Document.addeventlistener (' Touchmove ', function (e) {E.preventdefault ();}, False); If you don't want the page to slide, you can add this piece of code
4, share the Open source project
Moving the front interface in, we'll see the address bar, which doesn't look like an app, so how to hide the Address bar, which provides a more appropriate code to support iOS and Android.
Copy Code code as follows:
/*! Normalized address bar hiding for IOS & Android (c) @scottjehl MIT License * *
(function (Win) {
var doc = win.document;
If there ' s a hash, or addeventlistener is undefined, stop here
if (!win.navigator.standalone &&!location.hash && win.addeventlistener) {
Scroll to 1
Win.scrollto (0, 1);
var scrolltop = 1,
Getscrolltop = function () {
return Win.pageyoffset | | Doc.compatmode = = "Css1compat" && Doc.documentElement.scrollTop | | Doc.body.scrollTop | | 0;
},
Reset to 0 on Bodyready, if needed
Bodycheck = setinterval (function () {
if (doc.body) {
Clearinterval (Bodycheck);
ScrollTop = Getscrolltop ();
Win.scrollto (0, scrolltop = 1 = 0:1);
}
}, 15);
Win.addeventlistener ("Load", function () {
settimeout (function () {
At load, if user hasn ' t scrolled than ...
if (Getscrolltop () < 20) {
Reset to hide addr bar at onload
Win.scrollto (0, scrolltop = 1 = 0:1);
}
}, 0);
}, False);
}
}) (this);
Please visit the details: Https://github.com/scottjehl/Hide-Address-Bar
If your browser supports tag concealment:
Copy Code code as follows:
<meta name= "apple-mobile-web-app-capable" content= "yes"/>