Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ionic: cordova-plugin-inappbrowser set default target

Hello fellow programmers,

I've been experiencing a problem with the in-app-browser plugin. The reason is that I'm not able to give the target manually everytime te browser opens. This is because sometimes users fill in a link to their website inside a textfield.

Afterwards I was looking for a option to set a "default" option like (system, blank, ect.) But I wasn't able to find anything suitable.

I hope you guys can help me with this problem!

Greetings

like image 803
Giovanni Avatar asked Dec 16 '25 13:12

Giovanni


1 Answers

The Cordova Documents at this link shows what options can be used.

Target: The target in which to load the URL, an optional parameter that defaults to _self. (String)

_self: Opens in the Cordova WebView if the URL is in the white list, otherwise it opens in the InAppBrowser.

_blank: Opens in the InAppBrowser.

_system: Opens in the system's web browser.

Here is an example from my code to open an in app browser or the system browser.

$('#btnVisitToday').on('click', function (e) {
    e.preventDefault();
    window.open('http://www.sample.com', '_system');
});

I use _system to open up Google Play (have not tried it with app store)

like image 57
ElimGarak Avatar answered Dec 19 '25 07:12

ElimGarak