Adding an iOS Smartbanner through javascript

Number:rdar://21871593 Date Originated:2015-07-15
Status:Closed - wontfix Resolved:2015-08-04
Product:iOS Product Version:iOS 8.4 (12h143)
Classification:Bug (always) Reproducible:Always
When adding the meta tag that should add a smartbanner through javascript, it does not show up if the javascript is asynchronous or called trough an setTimeout().

Steps to Reproduce:
Open a html page containing this script on your iOS device:

function showBanner() {
   //add this meta tag to the html:
   //<meta name="apple-itunes-app" content="app-id=1008622954">
    var meta = document.createElement("meta"); = "apple-itunes-app";
    meta.content = "app-id=1008622954";  //or any other app id

and then call it with:
setTimeout(showBanner, 1);   //doesnt work!
this will NOT work
but this will:
showBanner();    //works

Expected Results:
The ios smart app banner should appear

Actual Results:
The ios smart app banner does not appear

iOS 8.4 (12h143)

See this stack overflow link for more details

Safari on iPhone 5s running iOS 8.4   Also tested on iOS 9 beta 2


Closed by apple

Closed by apple with this message: "This meta tag must be in the < head > tag when the page is loaded to show the banner."

Yeah, that is exactly the undesirable behaviour that I discovered. So they confirm the problem but dont appear to intend to fix it.

My reply: "So... It's a feature, not a bug?

Seems to me that this is undesirable and unpredictable, since it does work when adding it in the main thread of the javascript, but only failing when it is asynchronously.

This problem will become more and more prevalent when websites (usually large corporate) rely more and more on tagmanagers like Google Tagmanager, Qubit Open Tag or Adobe Dynamic Tag Management. And since those websites will not be able to drive traffic to the apps they want to promote, those apps will not be as successful as they should.

Please reconsider closing this issue, and investigate if this undesirable behaviour is fixable in a future release of Safari for iOS"

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!