標籤:android http io ar os sp for on cti
移動前端介面進去的時候,我們會看到地址工具條,這看起來不怎麼像一個APP,那麼怎麼隱藏掉這個地址條,下面提供了一個比較合適的代碼,支援IOS和Android.
/*! 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 hereif(!win.navigator.standalone && !location.hash && win.addEventListener ){//scroll to 1win.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 neededbodycheck = 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 more than 20 or so...if( getScrollTop() < 20 ){//reset to hide addr bar at onloadwin.scrollTo( 0, scrollTop === 1 ? 0 : 1 );}}, 0);}, false );}})( this );
詳細請訪問:https://github.com/scottjehl/Hide-Address-Bar
如果你的瀏覽器支援標籤隱藏的話:
<meta name="apple-mobile-web-app-capable" content="yes" />
移動前端:在手機上隱藏地址工具列