Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App doesn't cache its own code if opened only in jQuery mode from a secure server #801

Closed
Jaifroid opened this issue Jan 14, 2022 · 0 comments
Assignees
Milestone

Comments

@Jaifroid
Copy link
Member

Jaifroid commented Jan 14, 2022

This may only be for information, though a tweak or two could be made if it's considered an issue.

If a user visits https://moz-extension.kiwix.org/ independently in a browser, but never switches to Service Worker mode, then the app never caches its own code, so will not work offline. Once the user switches to SW mode, then the app will continue to work offline even if they switch back to jQuery mode.

In some senses this is academic because when we implement #196 this issue will go away. However, there is a possible interim solution which might be a way of "softly" introducing and testing #196. This would be to test whether the app is running from an https: server (or localhost) and switch to Service Worker automatically if it is.

This would be a half-way house to #196. It would not affect browser extensions (the main target), and would be a way of testing Service Worker as default. It would be pretty much a one-line PR:

if (/^https:|\/localhost[:\/]/.test(window.location.href) && navigator.serviceWorker) setContentInjectionMode('serviceworker');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants