gr8scott06
gr8scott06

Reputation: 931

Rails redirect to iOS custom url

Say I create some custom iOS url: customurl

In my rails controller

redirect_to "customurl://"

produces at runtime:

ERROR URI::InvalidURIError: bad URI(absolute but no path): customurl:// 

When I append some arbitrary path the redirect is successful.

redirect_to "customurl://w"

(User must now accept the page load, as opposed to a seamless redirect, which is undesirable).

Anyone have a solution to redirect to a custom url without some arbitrary path?

Thanks.

Upvotes: 1

Views: 1124

Answers (1)

hunterboerner
hunterboerner

Reputation: 1274

custom:// is not a URI. You must have something after that or otherwise it's not saying to go anywhere. Try going to http://. That work? No, it's not a URI. Same principle here.

EDIT:

Apple does some strange stuff so you have to do something with JavaScript. That is not actually a valid URI, Safari just detects it and launches the app.

Upvotes: 2

Related Questions