问题
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!
来源:https://stackoverflow.com/questions/42946505/open-external-url-in-cordova-webview-not-inappbrowser