"Safari cannot open the page because the address is invalid" message appears when I try to launch my app from a website

Vignesh Kumar picture Vignesh Kumar · Sep 19, 2016 · Viewed 48.5k times · Source

Device : iPhone 5 / iOS 9.3

I have an iOS app which I need to launch from a website. I was able to do it via custom URL scheme.

When I click the "Open App" button in the website, an alert dialog appears that says "Safari wants to open MyApp" with OK & Cancel buttons.

Clicking OK : everything is just fine. The app gets launched from the website perfectly.

Clicking Cancel : First time, it just dismisses preventing the app being launched, which is correct.

When I click on the "Open App" button once again from the website, I expect the same "Safari wants to launch MyApp" alert dialog to appear once again, which is not happening.

Instead, it shows a dialog that says "Cannot Open Page - Safari cannot open the page because the address is invalid" with an OK button.

My assumption was, every time when you click on that link in the website (that can launch the app via custom url scheme), I should be prompted with "safari wants to open MyApp" alert dialog all the time.

What am I missing here ? Appreciate your help in advance.

Answer

Honey picture Honey · Feb 25, 2019

It's a known behavior.

If you tap on facebook://feeds:

And open it then Safari won't blacklist the facebook scheme for that Safari tab. You would be allowed to open facebook://profile, facebook://feeds, facebook://settings, etc. on that tab

However if you click on 'Cancel' then you're no longer able to able any url with that scheme for that tab only ie you won't be able to open facebook://profile, because it's been blacklisted for that tab.

What should you do?

Open a new tab and try again. It would no longer be blacklisted for that tab.

It would have been much better though if Apple prompted its user with options like:

Deny once. Deny Always. Allow Always

But I'm guessing if they did that then they'd have to provide alternate ways for the user to customize behavior per host/scheme. Obviously Apple doesn't want to allow that.