-
-
Notifications
You must be signed in to change notification settings - Fork 13
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
Add service worker for offline caching #9
Conversation
8c64764
to
f7177e5
Compare
A service worker has been added that caches the phishing warning page. This ensures that it remains functional if GitHub pages goes offline. The service worker precaches all CSS, HTML, SVG, and JavaScript files. These are the files required for the site to function properly. The fonts and the `.ico` favicon used by older browsers are omitted to reduce the cache size. I did attempt to add a runtime cache for the fonts, but I could never get it to work correctly so I abandoned the effort. It's not critical, the fallback web font looks fine.
f7177e5
to
3fe93ef
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks Dan! Sorry I marked this as ready for review prematurely, I meant to add more docs and QA instructions. I'll do that now |
To QA offline support, I used these steps:
Previously, the page load would fail after disabling network requests. After this PR, the page should render correctly after a second or so, after the browser lets the network request timeout. It does initially display a "failed to load" page until that second elapses. To test that the service worker updates correctly and doesn't keep stale assets around:
It should load the updated asset correctly. |
A service worker has been added that caches the phishing warning page. This ensures that it remains functional if GitHub pages goes offline.
The service worker precaches all CSS, HTML, SVG, and JavaScript files. These are the files required for the site to function properly. The fonts and the
.ico
favicon used by older browsers are omitted to reduce the cache size.I did attempt to add a runtime cache for the fonts, but I could never get it to work correctly so I abandoned the effort. It's not critical, the fallback web font looks fine.