window.cordova and window.FirebasePlugin are not accessable #521
Replies: 1 comment 4 replies
-
In App browser context does not have access to the cordova bridge and this is by design. The in app browser is intended for viewing remote-based untrusted web content. It's a security issue (and a policy issue with Apple & Google) if remote content can access native device APIs. Therefore plugins are restricted to the main app webview.
https://github.com/apache/cordova-plugin-inappbrowser?tab=readme-ov-file#windowopen |
Beta Was this translation helpful? Give feedback.
-
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
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.
Beta Was this translation helpful? Give feedback.
All reactions