GitHub user SamiraHuber edited a discussion: window.cordova and 
window.FirebasePlugin are not accessable

Hey together,
I am new to Cordova - only did web and app programming before and I am 
currently struggling a lot and I hope someone could maybe help me.

I want to show a web page inside cordova to make notifications and location 
accessible. I had an old app as an example which doesn't work anymore since the 
server for an API call changed and since it uses really old versions, I thought 
it is better to rebuild it. But now, I just struggle in so many small things.

So I load the app with InAppBrowser
`var browser = 
cordova.InAppBrowser.open(url,'_blank','location=no,zoom=no,hidden=no,hardwareback=no,toolbar=no');
`
But inside the app, I don't have access to window.cordova

but in the old project, this was run to load the cordova.js file
```
var isCordovaApp = !!window._cordovaNative || !!window.cordova;
if (isCordovaApp) {
      var cordovaScript = document.createElement('script');
      cordovaScript.type = 'text/javascript';
      cordovaScript.src = '***injected***/cordova.js';
      var cordovaPluginScript = document.createElement('script');
      cordovaPluginScript.type = 'text/javascript';
      cordovaPluginScript.src = ***injected***/cordova_plugins.js';

      document.head.appendChild(cordovaScript);
      document.head.appendChild(cordovaPluginScript);
```
So there, window.cordova seemed to be set.

But neither I are the files (cordova.js, cordova_plugins.js) included in the 
web-project, nor is this called, since isCordovaApp is false.

I than thought I just try to add this scripts directly and this worked, except: 
I cannot access window.FirebasePlugin (from the firebasex plugin). It is 
installed and from a javascript file inside the cordova app, I can do all the 
things I want. But not from the website. The Plugin-Script was loaded inside 
the web, but no chance. And really no idea on how to get it to work...

I ran it on my android device. I use chrome inspect to check the console logs.

Any idea what I miss or do wrong? I really appreciate any idea, tip or info.

GitHub link: https://github.com/apache/cordova/discussions/521

----
This is an automatically sent email for issues@cordova.apache.org.
To unsubscribe, please send an email to: issues-unsubscr...@cordova.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to