Use existing cordova app as a Web App?

Hi, I have a few Cordova Apps built with VoltBuilder.

When testing I run the app in the local web browser, but of course the cordova plugins do not work.

I want to adapt the Cordova app to run fully in a web browser so I can run it inside an iframe on my website aswell.

I have this function to detect cordova or not:

document.addEventListener("DOMContentLoaded", onLoaded, False);
Function onLoaded()
  console.log("Loaded");
  If (window.hasOwnProperty("cordova")) = True Then
    console.log("Mobile App");
  Else
    console.log("Web Browser App")
  End If
End Function

Which seems to work, but what I now need to do is hook all the cordova functions and replace them with a browser compatible function at onLoaded, such as

cordova.InAppBrowser.open = window.open()

The above = Error cordova is not defined.

This seems to work

document.addEventListener("DOMContentLoaded", onLoaded, False);
Function onLoaded()
  console.log("Loaded");
  If (window.hasOwnProperty("cordova")) = True Then
    console.log("Mobile App");
  Else
   console.log("Web Browser App")
   window.cordova = window;
   cordova.InAppBrowser = window;
  End If
End Function

Just need to work in the others now.

Here’s a link to a post I just did that tells you how to emulate cordova/plugins on a website for debugging.