justme24x7
justme24x7

Reputation: 61

Open external URL in cordova webview (NOT inAppBrowser)

What I want to do? To open an external URL to open in the internal cordova webview, where the index.html file loads by default.

What do I not want to do and why? Use the inAppBrowser, because (1) in android it shows the address bar. (2) The external URL of the website is such that people post links there often.. They all open up in the inAppBrowser. I would prefer them to open in a different browser in the phone.

What have I tried so far without success?

(1) window.location.href="http://www.example.com";

(2) window.open('http://www.example.com', '_self ', 'location=yes');

(3) var url = 'http://www.example.com'; var target = '_blank'; var options = "location=yes, toolbar=no"; var ref = cordova.InAppBrowser.open(url, target, options);

(4) Use an iframe in index.html <iframe src="http://www.example.com ></iframe>

(5) <allow-navigation href="http://*/*" /> <allow-navigation href="https://*/*" /> <allow-navigation href="tel:*" /> <allow-navigation href="sms:*" /> <allow-navigation href="mailto:*" /> <allow-navigation href="geo:*" />

Any leads would be helpful. Thanks a lot in advance folks!

Upvotes: 3

Views: 4917

Answers (1)

Eskim0
Eskim0

Reputation: 834

With Apple's new WKWebView requirement, this just got sloppy. None of the whitelisting etc worked for me, nor could I use InAppBrowser.open now window.open with _system target. I ended up using this plugin and solved.

https://github.com/PaoloMessina/OpenUrlExt

Upvotes: 1

Related Questions