隐藏移动DNN webApp for iphone和android上的地址栏

时间:2016-08-25 16:03:18

标签: javascript android ios iphone dotnetnuke

我试图隐藏iphone和android的地址栏(如果可能的话)并且看到多个线程使用以下代码片段作为其DNN网站的一部分,方法是将以下内容插入到default.aspx文件中:

<%-- Add mobile bookmark buttons --%>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="mobile-web-app-capable" content="yes">

<%-- Set Apple icons. --%>
<asp:PlaceHolder ID="appleIcons" runat="server" />

<%-- Set view port for mobile devices. --%>
<meta name="viewport" content="width=device-width" />
<meta name="viewport" content="width=device-width, minimal-ui">

<%-- Set Apple icons. --%>
<link rel="apple-touch-icon" href="/Portals/0/images/apple-touch-icon-114x144.png" />
<link rel="apple-touch-icon" sizes="72x72" href="/Portals/0/images/apple-touch-icon-114x144.png" />
<link rel="apple-touch-icon" sizes="114x114" href="/Portals/0/images/apple-touch-icon-114x144.png" />
<link rel="apple-touch-icon" sizes="144x144" href="/Portals/0/images/apple-touch-icon-114x144.png" />

<%-- Remove URL bar on mobile devices. --%>
<script type="application/x-javascript"> 
    addEventListener("load", function() { setTimeout( hideURLbar, 0); }, false); 
    function hideURLbar(){ window.scrollTo(0,1); } 
</script>

我已经测试了这个主题的所有相关主题。以上工作在以前的网站上,虽然只在iPhone上,但不再为我工作。感谢任何评论。

1 个答案:

答案 0 :(得分:0)

更新:回答我自己的问题(注意仅适用于移动网络上的移动网络应用):

<%-- Add Apple & Android bookmark buttons --%>    
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="mobile-web-app-capable" content="yes">

<%-- Set view port for Apple & Android devices. --%>
<meta name = "viewport" content = "width=device-width" />
<meta name="viewport" content="width=device-width, minimal-ui">

<%-- Set Apple & Android icons. --%>
<link rel="apple-touch-icon" sizes="96x96" href="/Portals/0/images/favicon-96x96.png" />
<link rel="icon" type="image/png" sizes="96x96" href="/favicon-96x96.png">

<%-- Set Apple Smart App Bannner by entering app store url in app id field below. --%>
<meta name="apple-itunes-app" content="app-id=myAppStoreID, affiliate-data=myAffiliateData, app-argument=myURL">