Replace default Ionic webview with external website

Viewed 726

I'm trying to replace the default Ionic Cordova webview with the contents of an external website. I do not want this external website to open up the in app browser however. I simply want the app to display the website.

I've added the following to my config.xml file, but this just opens up a web browser and goes to the specified website.

<content src="https://somewebsite.com/" />
<allow-navigation href="*://*.somewebsite.com/" />
1 Answers

Use the Cordova InAppBrowser (directly or with the Ionic wrapper) and use the target of _self. Since you've already whitelisted the URL, it should open in the webview.

e.g: cordova.InAppBrowser.create('https://somewebsite.com/', '_self', 'usewkwebview=yes')

Related