HI Thank you for comments.
I figured it out in the end. I generally build for Android and iOS with cordova plugins which I want to also host as a desktop app from my website.
I went with:
document.addEventListener("DOMContentLoaded", onLoaded, False);
If (window.hasOwnProperty("cordova")) = True Then
console.log("Web Browser App")
For the functions which I was using cordova for:
If localStorage.getItem("AppType") = "WebApp" then
dont call cordoa plugin function
call cordova plugin function