Reputation: 160
Want to be able to deploy my app to Firebase and use Cordova functionality in the browser. Get an error that cordova_not_available when opening the firebase website.
To be able to run Cordova on the browser in this case chrome in the first place I added the browser platform to my project and the use the Cordova run command instead of serve.
But when I deploy to the website I get the Cordova not available error
Upvotes: 0
Views: 130
Reputation: 10237
You can use the cordova-browser
platform to run in any modern browser. More info
Now, when you run for a browser, you need to keep in mind to
cordova.js
in your index.html
Device plugin is one such plugin which supports a browser platform. Have a look at this video on how you can configure and run device plugin with Cordova on chrome.
Specific to your case, more chances that you get the error cordova not available is because you might have missed adding cordova.js
to your index.html
file.
Upvotes: 2
Reputation: 598787
Cordova functionality is only available in Cordova, not in a standalone browser. See https://forum.ionicframework.com/t/pwa-how-to-access-cordova-plugins-in-pwa-web-applications/147575
Firebase Hosting hosts web sites, not Cordova apps. The latter are run as native apps on your device, providing extra native functionality to your JavaScript code. A lot of that functionality is these days also available directly in browser APIs, but it may have a different form there. You'll have to look at each piece of functionality in turn, and possibly reimplement it using native APIs for the web platform.
Upvotes: 1