Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Fred_R_
Beginner
255 Views

how to prevent links from opening in external browser by default on IOS after update ?

Hey guys, 

I have an app that, for some screens, opens an external url www.mysite.com/screenexample.html. I had it working properly on Cordova CLI 5.1.1. Now I updated to 6.2, and when I click on some buttons, the app opens the url in the external browser by default, it doesn't stay on my app. How to prevent that? I didn't change anything in the code, but now every link to the web is opening in the external system browser, not my app.

This is happening only on iOS. On Android it works fine.

How to prevent safari from opening when people click on a link in my app?

Thanks!

Tags (2)
0 Kudos
4 Replies
PaulF_IntelCorp
Employee
255 Views

Fred -- I recommend you do not use a window.open() or href (or eqivalent), use the inAppBrowser plugin. Check the API in the git repo for that plugin for more details. It will give you the control you want over how links are opened. You'll have to change your code to make this work. Search for "cordova inappbrowser" to find the docs and plenty of examples.

Fred_R_
Beginner
255 Views

I see. I can do that from my app for the first link that opens an external page, but then, what if there is a link within that external page that uses href, what will happen?

PaulF_IntelCorp
Employee
255 Views

See the docs > https://github.com/apache/cordova-plugin-inappbrowser#cordovainappbrowseropen < you may have to experiment with it to get a full feel of what it does and does not do for you.

Reply