EddyVerbruggen / Custom-URL-scheme

:link: Launch your Cordova/PhoneGap app by a Custom URL scheme like mycoolapp://
1.03k stars 367 forks source link

2 or more cordova apps using this will *all* be called when custom URL is opened #225

Open pke opened 7 years ago

pke commented 7 years ago

I have 3 cordova apps installed that each have the other 2 apps url schema whitelisted. When app (a) calls window.open("appb://login", "_system") it also itself receives that very URL in its handleOpenURL handler function. That happens on iOS and Android alike.

Is that the expected behaviour? I'd have thought only the app registered for a specific URL schema is opened?

dbarn commented 7 years ago

I think this is similar to the issue I am having here https://github.com/EddyVerbruggen/Custom-URL-scheme/issues/226

pke commented 7 years ago

@dbarn Yes, but it seems the plugin author doesn't have a solution for that. It seems however, that the error is in the cordova-ios plugin, which listens for navigation events. https://github.com/apache/cordova-ios/search?utf8=%E2%9C%93&q=CDVPluginHandleOpenURLNotification

The IAB sends this notification to all listening plugins, and cordova-ios happens to also listen for it. You need to check in your handleOpenURL if the scheme is related to your app.