PWA offline after app restart #3205
-
Hi everyone not sure this is the right place but I wanted to ask something about offline apps. I noticed in Android Capacitor calls the following mehtod to load the view: and it's called every time the app is loaded, so I was wondering whether there is a way to kill the app and still have the app working offline. Thanks everyone |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
The question is confusing because you say it's a PWA, but then mention If the later, Capacitor uses WKWebView on iOS, which doesn't support service workers. And on Android they work on the WebView, but doesn't work well when using Capacitor. |
Beta Was this translation helpful? Give feedback.
The question is confusing because you say it's a PWA, but then mention
webView.loadUrl(appUrl);
.So are you running it from Safari/Chrome or as native iOS/Android app.
If the later, Capacitor uses WKWebView on iOS, which doesn't support service workers. And on Android they work on the WebView, but doesn't work well when using Capacitor.
Capacitor apps don't need service workers for offline resources since the app ships with all the code bundled, so you should probably disable the service worker for the native build.
For Android, there is a workaround if you want the service worker to work, that will just pick the local files, see #1655 (comment)