Ionic Native, InAppBrowser, Javascript, reference InAppBrowser object

Hi

I’m at a bit of a loss, hopefully someone here will have come across this.

I am using the Ionic Native InAppBrowser, with

import {InAppBrowser, InAppBrowserRef} from 'ionic-native';

then I am looking to use the standard functions:

browser.show(); browser.close(); browser.addEventListener(type, callback); browser.executeScript(script, callback); browser.insertCSS(css, callback);

The problem I have is that I am using plain Javascript, so I’m looking for a translation of this syntax:

let browser: InAppBrowserRef = InAppBrowser.open(url, target, options);

into Javascript so I can use the InAppBrowser object across my page functions.

Any help please?

Thanks

Tom

var browser = InAppBrowser.open(url, target, options);

Hi

Thanks for the reply. You mean you put this In the constructor?

Tom

Hi, putting it before making any browser.call() should do if I understand you correctly.

I’d strongly recommend converting your project to typescript, can save you a lot of hassle along the way.