Hacker News new | past | comments | ask | show | jobs | submit login

For a multi-page app, one of the important uses of serviceworkers is pre-loading and caching resources that aren't on the first page. eg you might have a background image that's only displayed three pages deep but can download and cache it as soon as the site is open.

You can potentially use http2 push to send down files from the server early but I've seen the browser drop the files if they're unneeded for that page load.

Yes, there are other hacks you could do to make the browser download the resources early, like invisible images or preload audio files, but if you're going down that path why not put in a service worker instead and have it download in the background.




Unfortunately HTTP/2 push is basically dead. Very few sites made use of it and Chrome removed it: https://developer.chrome.com/blog/removing-push


Preload link tags work great and have been supported for over a decade.


If preloading is the goal, would hidden/off-screen loading be an option for images?




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: