How do I inject javascript in web view Android?

Hi,

I am trying to add a header bar in web view for my app. I am using the cordova inAppBrowser plugin for this. To test it I added this code:

var win = window.open( URL, "_blank", 'location=yes' );
win.addEventListener( "loadstop", function() {
    win.executeScript({ code: "alert( 'hello' );" });
});

The URL opens but I do not get any alert in the web view.

EDIT:

So, after some debugging I figured out that the method executeScript()isn’t defined. That is I get an error TypeError: undefined is not a function. The same happens when I use win.show() and win.addEventListener(). Only open() and close() seem to work. Is there some problem with the installation?

you try something different instead of an alert?
Like adding a text directly to the body or a console.log?

I tried console.log() but still didn’t get anything.