Search code examples
javascriptios6meta

Smart app banner close event


Currently implementing the smart app banner into a web app until i came across the problem where i can't catch the close event.

<meta onblur="alert('close');" name="apple-itunes-app" content="app-id=123456789">
<meta onclick="alert('close');" name="apple-itunes-app" content="app-id=123456789">

Seems unlikely that these would work in the first place but just had to try :)

window.resize event is called after closing the banner but it takes up to 2-3 seconds before it is activated, in my case that's to long.

My question: Is there a way to catch the closing event for the smart app banner?


Solution

  • I don't think that this is possible:

    Taken from apple's description:

    They will appreciate that banners are presented unobtrusively at the top of a webpage, instead of as a full-screen ad interrupting the web content.

    The catch is, that it is not only on top of your webpage but on top of the actual webview of the browser. So any interaction with the SAB is not possible until Apple decides to provide a JS-API for this.

    I played around with the SAB myself and tried changing the app-arguments on runtime using JavaScript. But this won't work either.