简体   繁体   English

使用时如何在iPhone上隐藏网址栏

[英]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.

相关问题 使jQuery mobile与apple-itunes-app兼容 - Making jQuery mobile compatible with apple-itunes-app 如何刷新Apple移动Web应用程序状态栏样式元标记? - How can I refresh the Apple mobile web app status bar style meta tag? 使用Apple元标记进行全屏网络应用 - Using the Apple meta tag for full-screen web app 如何通过itunes.apple.com URL获取iTunes嵌入代码? - How to get iTunes embed code by itunes.apple.com URL? 如何让我的应用程序使用Phonegap运行“Always On Top”? - How to put my app to run “Always On Top” using Phonegap? 如何删除在顶部ionic v1应用上显示iPhone电池的白色边框/条形? - How to remove white border/bar that shows iPhone battery at top ionic v1 app? 使用javascript或jquery打印页面时,如何隐藏url - how to hide the url comes while printing the page using javascript or jquery 如何隐藏基于 Web 应用程序运行的 PWA(渐进式 Web 应用程序)中的顶部导航栏 - How to hide the top Navigation bar inside PWA (Progressive Web App) which is running based on Web Application .hide/.show 跳转到页面顶部或在 url 中显示 div 名称 - .hide/.show jumps to top of page or shows div name in url 如何在反应应用程序中在移动设备上“隐藏地址栏”? - How to "hide the address bar" on mobile in a react app?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM