[英]How to hide URL bar on iPhone while using <meta name=“apple-itunes-app” to put an ad for app at the top of the page?
I have a mobile web page where I want to put an ad for an iOS app at the top of the page using Apple's meta tag like this: 我有一个移动网页,我想使用Apple的meta标签在页面顶部放置iOS应用广告,如下所示:
<meta name="apple-itunes-app" content="app-id=myAppStoreID, affiliate-data=myAffiliateData, app-argument=myURL">
So I added that line to my HTML. 因此,我将该行添加到了HTML中。 Then I opened the web page on an iPhone and the ad is there, but it's above the top of the page.
然后,我在iPhone上打开了网页,该广告在那里,但它在页面顶部上方。
The page uses window.scrollTo(0,1)
to hide the url bar on iPhone, but it looks like the add is positioned at -50px, so I could try window.scrollTo(-50,1)
but sometimes the ad is there and sometimes it's not. 该页面使用
window.scrollTo(0,1)
隐藏iPhone上的网址栏,但看起来添加位置位于-50px,因此我可以尝试window.scrollTo(-50,1)
但有时广告在那里有时不是。 If you click the (X) on the ad, it remembers to not show the ad again until you clear the cache. 如果您单击广告上的(X),则记住在清除缓存之前不要再次显示广告。
Is there a way to know if the ad is showing? 有没有办法知道广告是否正在展示? Or am I just not able to hide the URL bar with this type of ad?
还是我无法隐藏此类广告的网址栏?
Thanks! 谢谢!
Try adding the following Apple-specific meta tags at the head of your HTML document. 尝试在HTML文档的开头添加以下特定于Apple的meta标记。
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
With the above meta tags, I don't think you still need to call window.scrollTo(0,1) to hide the URL bar 有了上述meta标签,我认为您仍然不需要调用window.scrollTo(0,1)来隐藏网址栏
Refer to this documentation Apple-Specific Meta Tag Keys for details. 有关详细信息,请参阅此文档Apple特定的元标记密钥 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.