Skip to content Skip to sidebar Skip to footer

How To Prevent To Open External Link In Browser In Cordova?

I am using angular2 with cordova for android app. In this I'm using payment gateway so, to do this I need to post form values to external payment URL without opening browser. Sampl

Solution 1:

To make the form submit not open in browser you have to allow navigation to that url. You can do it by adding an allow-navigation entry in your config.xml like this <allow-navigation href="http://example.com/*" />.

In Android you will also need to install cordova-plugin-whitelist

But you should not really do a form submit to an external url, you should use XHR (AJAX) to send the POST to the server instead of the form submit.

Post a Comment for "How To Prevent To Open External Link In Browser In Cordova?"