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
Switch to a Service Worker #774
Comments
It looks like, as of EdgeHTML 17.17063, Service Workers are enabled by default 😄 It'd be good to support this, as Service Workers are a requirement for submission to the Microsoft Store. |
Updated. Thanks! |
Since Chrome 68 the "Add to homescreen button" is no longer available for manual use on Android. Instead, websites can trigger an "Add to homescreen" dialog if the website meets certain criteria. One of these criteria is registering a service worker with a |
Thumbs up to converting devdocs from appcache to serviceworkers. |
I would vote against that, because I like this project and Service Workers might be insecure so are disabled by many people (me included). |
The method the site currently uses to provide offline functionality is on its way to being deprecated. If there isn't a move to service workers we'll probably lose offline functionality. It won't be terribly hard to do anyway. Once the site is cached for offline use, the rest of the data is installed into localStorage. |
@eloyesp you mention "insecure" except the linked question is regarding privacy. Privacy and security are different (although related). Regarding the privacy concerns of service workers, there is negligible risk. Service workers get woken up to handle two types of events:
SWs don't fundamentally change the security and privacy models of the web. Origin restrictions, CORS, etc are all still in effect. |
Just wanted to chime in that I'd personally like this so that the site can be installed as a standalone PWA on desktop environments as well. |
I will start working on this next week, although it might take a while to complete because it's quite a big change. I will comment on this issue when I make significant progress and/or when I get a working demo with service workers online. |
Time for an update. I have successfully replaced the App Cache with a Service Worker in jmerle/devdocs#service-worker. There is a live demo running at sw.devdocs.jmerle.dev. This change to a Service Worker also means that DevDocs will be an installable PWA. I have already tested the changes on the following browsers:
Because I do not have access to any Windows or Apple machines at the moment and don't want to have such a change deployed without knowing it works on all our supported platforms, it would be really nice if some people can test the changes on a recent version of Edge on Windows, Safari on macOS and Safari on iOS. To help test the changes, do the following:
|
Works on Safari on iOS 12.3.1 🎉 |
And on Safari 12.1 on macOS 10.14.4. |
Sweet, thanks! If someone can confirm it works on Edge I'll open a PR. |
@jmerle I can verify with Edge in an hour or two 🙂 |
@jmerle, just tried it out using EdgeHTML 18.18362 on Windows 10 Version 1903. Looks great; thank you for taking the time to implement this! A few notes:
I could definitely have been doing something wrong (or perhaps this was intentional at this time), so please let me know if there's anything else I can do to help debug :) |
@cglong I haven't looked at the inner-workings, but did you try marking some docs as available for offline in the settings, rather than just visiting them once? |
@cglong thanks for testing it on Edge! The error you see can indeed be caused by not having downloaded the documentation for offline usage, although our current App Cache version of DevDocs does seem to support loading documentation entries without downloading them for offline usage when you have visited the entry before. While implementing something similar with service workers is possible, I'll leave that open for a future PR. I have updated the error message slightly to tell users to install documentations before going offline and have created a PR at #1022: |
@jwkicklighter @jmerle Oh duh, I forgot I had to do this 😅 Sorry! I just tried requesting the docs be installed and verified everything works as expected in Edge 😎 |
@jmerle thanks for getting this done so quickly, it was the biggest feature I've wanted to see since I started using devdocs! |
The service worker changes are now live on devdocs.io 🎉 |
Can this issue be closed, since Service Worker is implemented? |
Yes, this can be closed. Thanks, @trysten. |
It looks like Service Workers are supported on the latest versions of all of the browsers.
Some ideas:
If we use Service Workers, we won’t have to do anything different when offline vs online — just fetch the docset from the URL, and the worker will proxy it to the cache, even if the user is online (we can also fetch an updated version if the cached copy is out-of-date and store it for the next time the page gets loaded).
Demo will be available here at some point (it’s still on AppCache right now)
The text was updated successfully, but these errors were encountered: