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

4

18

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.

Nieberg answered 19/9, 2016 at 4:26 Comment(4)
Check your url formatDepot
@KrutarthPatel: It is a valid one. The url is the same as it was in the first attempt.Nieberg
Refer this link : #17080835Depot
Thanks for your reply. I think this is a default Safari behaviour. Since I declined the open app confirmation question, it is not allowing the app launch from then on, until you refresh the page.Nieberg
S
12

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.

Sculptress answered 25/2, 2019 at 20:26 Comment(1)
this was exactly my problem-- just close that tab, try again and it worked like a charm!Almsman
T
-1

I met the same problem when using Google Tag Manager in my code. Try the javascript event for opening the app instead of using the href of the tag a.

Tautomerism answered 5/3, 2018 at 9:33 Comment(0)
N
-1

I was getting a similar error, fixed it by allowing "Installing App" in restriction(Settings->General->Restriction), enable the toggle button. It is by default enabled but I restricted it in past by disabling the toggle button.

Hope this helps anyone.

Niggling answered 13/3, 2018 at 13:38 Comment(0)
S
-3

I just fixed the same problem on an iphone. Go to settings> General> Restrictions> Safari. Make sure it is "allowed" or turned on (swipe to green). Exit out of settings and retry. It should work.

Sunset answered 2/7, 2017 at 13:39 Comment(1)
This did not fix the issue for me. I don't have Restrictions enabled for any of my devices.Humes

© 2022 - 2024 — McMap. All rights reserved.