How to use inappbrowser plugin?

I’m trying to use cordova plugin in my framework7 project built with webpack using following code:-

$$(document).on("page:init",'.page[data-name="home"]',function(e,page){
  var ref = window.cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
});

It shows following error:-

window.cordova is not defined

How can i access the cordova plugin in my app.js

What method are you using to debug your app? Cordova will only run if you are debugging with it. I’d suggest using Visual Studio Code with the Cordova tools extension to debug Cordova projects on the desktop.

can you explain the process of debugging the app

Let’s back way up… Firstly, how did you install Framework 7; Was it from the CLI? Or, do you know if you have otherwise installed Apache Cordova?

I’m using framework7 webpack project created using framework7 cli and yeah, cordova is installed in the project

Make sure your Javascript code falls inside of the ‘deviceready’ event. Cordova plugins will only become available once Cordova is properly initialised.

document.addEventListener("deviceready", onDeviceReady, false);

function onDeviceReady() {
 // Your plugin-specific code here
}

Cordova isn’t used when debugging on a standard web server or using Chrome/Safari/etc to view pages from the file system. You need to be running Cordova in the debug session, so make sure you either run on a physical device or in an IDE simulator, or run a Cordova simulator like the one for VS Code.

It would be great if you can point me to some github repository projects which are using webpack framework7 project.What is the syntax for accessing cordova plugin in app.js. Most probably it looks like it’s occuring due to incorrect syntax @nolimits4web Can you provide your valuable insight or a example?