kiwix / kiwix-js-pwa

Kiwix JS Offline Browser implemented as a Progressive Web App (PWA), and packaged as Electron, NWJS and UWP apps for Windows and Linux.
https://pwa.kiwix.org
GNU General Public License v3.0
176 stars 29 forks source link

Electron app has to perform self-reload in order to activate Service Worker #334

Open Jaifroid opened 1 year ago

Jaifroid commented 1 year ago

When the Electron app starts up, the Service Worker is in a strange state: it is active but "not controlling the current page". To fix this, the app performs a self-reload, which successfully attaches the Service Worker. However, there should be a better way of ensuring SW can control the page. This doesn't occur in the PWA version. It may be caused by the patched URL schema in Electron apps (they use the file:// protocol, but patch it so that it is recognized as a secure origin).

Jaifroid commented 1 year ago

Fixed in #338.

Jaifroid commented 1 year ago

The solution to #342 showed that the reload is still happening to activate the Service Worker, albeit very fast and early in the load process. It remains to be seen if this means #337 is not properly fixed.