ram111cv
ram111cv

Reputation: 65

Cordova- embed a external website into cordova app

I have a website. it run good in server I'm building a cordova app to embed this website and I want to open this website into this cordova app.

I use window.open(..., "_blank").. window.open(..., "_selt") modify config.xml <access origin.... but when I run app in my device, website auto open in browser.

How to open website in my app? I don't want to use iframe.

Upvotes: 4

Views: 4773

Answers (1)

Sunil Dodiya
Sunil Dodiya

Reputation: 2615

Since You have already created cordova app, you need to add Inappbrowser plugin to app so you can open your website in it. [Add other necessary plugins]

To add Inappbrowser plugin use following command.

cordova plugin add org.apache.cordova.inappbrowser 

Add following line to index.js to open your website link.

var url = "https://www.example.com";
var ref = window.open(url, "_self");

ref = reference to the InAppBrowser window object, you can add Listener to object to perform additional operation. for more help related to inappbrowser plugin check this link.

Upvotes: 2

Related Questions