简体   繁体   中英

Is it possible for Cordova plugins to work with PWA?

I am looking for a PWA deployment, currently, I am using the Ionic app. I am using Cordova plugins which are only supported on the device. How do that work with Ionic on a browser?

Yes, You can, if you pack your web app as a cordova hosted web app. To put it in other words, build a regular cordova app with a webview pointing to your web server URL. Your web-app can have code interacting with cordova plugins.

There is no way to use Cordova plugins in a PWA app without packing it work cordova (at-least as of 2018 March and in near feature). Said that, you cant make use of cordova plugins in PWA apps when it is running in browser / installed it using "add to home screen option".

PWA apps as such are run in browsers (including installed ones using "Add to Home Screen option", but without address bar). Browsers don't have native code access, which are needed for Cordova plugins to work.

In a regular cordova app, including Ionic cordova, its a native app with webview. So the native part of the app has access to native API, which is wrapped with JS interfaces for use in web apps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM