Denis
Denis

Reputation: 11

How to make iOS universal links work inside an iframe

First, we have an app and our domain supports Universal links on iOS9 and iOS10. On the landing page there is an element with 'href' attribute set to our domain. Clicking on it launches our native app or opens UL in the browser. This is working.

However when the same landing page is put inside an iframe(expected use case) that button doesn't work as expected. Instead of launching our app I can see in the Consoles: "https://domain/path/page.html" was not allowed to display insecure content from itms-appss://itunes.apple.com/app/appname/id#######?mt=8. Which means that UL mechanism didn't work and the browser actually retrieved the URL (which in turn is a simple PHP file sending the Location header redirecting to iTunes)

I thought may be there was something with our app or the page or the subdomain so I tried to add similar links for Instagram app. That didn't help because behavior was the same: UL mechanism didn't work and browser retrieved contents of the UL.

Pseudo-HTML:

<body>
<a href="universal_link">Works</a>

<iframe src="your_random_local_page.html">
    <a href="universal_link">Doesn't work</a>
</iframe>

</body>

Upvotes: 0

Views: 3068

Answers (2)

Udom
Udom

Reputation: 339

Just leave from iframe by

<body>
<a href="universal_link">Works</a>

<iframe src="your_random_local_page.html">
      <a target="_top" href="universal_link">Doesn't work</a>
</iframe>

</body>

It's work fine for me.

Upvotes: 3

Alex Bauer
Alex Bauer

Reputation: 13613

We need additional detail — there isn't enough here to get the full picture. Ideally, a link to your live landing page would be best, but failing that, at least more info on where the Universal Link is pointing.

Preliminarily, I suspect your Universal Link is somehow redirecting to the App Store page, which will be attempting to launch the App Store app itself via the itms-appss:// URI scheme. Custom URI scheme redirects within iFrames have been blocked since iOS 9.3, so this is would be expected behavior.

Upvotes: 0

Related Questions