TruckMovers / cordova-plugin-remote-injection

DEPRECATED: Cordova plugin to allow a remote site to interact with cordova's javascript APIs when loaded within a cordova app.
Apache License 2.0
91 stars 95 forks source link

Link opens in Safari instead of navigating to it #4

Closed matthewma7 closed 8 years ago

matthewma7 commented 8 years ago

Hi, It's me again. Thanks for the 0.2.0 update. It works with all my plugins.

Since I upgrade to cordova ios 4.1.1. I noticed a behavior change, when click on a link (a tag) like this <a href="#">Link</a>, built in safari will be opened instead of navigating the WebView to that page.

I thought this is a easy things to fix but after messing with things like <allow-navigation /> <access origin="*" /> for a while I still can't make this opening safari behavior go away.

This behavior doesn't exist on corodva ios 3.9.2 with previous version of this plugin. This behavior also doesn't exist when not using external website but use traditional 'stuff in www' folder.

Do you any insight on this issue?

Sincerely,

bradleyjames commented 8 years ago

Have you tried uninstalling cordova-plugin-remote-injection to see if it's the culprit? I just tried on a test project and I see the behavior with and without our plugin meaning I don't think we created this behavior.

As an aside we use the InAppBrowser plugin to be able to control how the app behaves with links. All of our links are created via JS though so we're using window.open().

I don't have the time right now to dive into it but if you see the same result without our plugin the general cordova community might be able to help as well. I'm not trying to put you off, just saying you might get quicker help from them.

I'd like to know the answer myself and will dig into it when I get a free moment. Please post back with anything you find!

matthewma7 commented 8 years ago

Sure. I'll dig into this more and keep you posted.

matthewma7 commented 8 years ago

Thanks for point out cordova community, I found the solution here.

The issue is not related this plugin. The issue is related opening external website on Cordova ios 4+. Basically remove <allow-intent href="http://*/*" /> <allow-intent href="https://*/*" /> from cordova config.xml solved the problem. I guess because the url of external website falls into the intent filter, so a open link intent is send to the ios system. Handle navigation in JavaScript could avoid this too.

I'll close this issue now. :smiley:

bradleyjames commented 8 years ago

Great, thanks for following up.