Ionic-native: InAppBrowser insertCss Not Working

Created on 28 Dec 2016  路  3Comments  路  Source: ionic-team/ionic-native

I instanciate a an InAppBrowser with
let browser = new InAppBrowser('my_fancy_url', "_self", 'location=no,hidden=yes,useWideViewPort=yes');

Then a call on browser.insertCss({code: this.cssETransaction}); raises an error :

TypeError: Cannot call method 'apply' of undefined

I tried to call insertCss() after browser.show(), I tried to set hidden to no but I never managed to insert CSS.

On the other hand on chrome://inspect when I call the InAppBrowser from cordova.InAppBrowser.open(...) I can easily insertCss.

Any Thoughts on that ?

Most helpful comment

Just pushed a commit to fix this, will be available in the next release.

All 3 comments

I get a similar error using insertCss in the iOS simulator:

TypeError: undefined is not an object (evaluating 'pluginObj._objectInstance[methodName].apply')

In order to workaround this I have added the following code to my project. It is a ugly hack that creates an alias in the cordova-plugin-inappbrowser plugin.

const browser_proto = (this.browser as any)._objectInstance.__proto__;
browser_proto.insertCss = browser_proto.insertCSS;

Just pushed a commit to fix this, will be available in the next release.

Was this page helpful?
0 / 5 - 0 ratings