Skip to content Skip to sidebar Skip to footer

Is It Possible To Cache A Broken Image?

I'm looking for a way to ensure that the browser caches invalid/broken 'images' such that when there is a re-fetch, the loading time is immediate. Below are two scenarios I'm parti

Solution 1:

Modern browsers come with something called service worker -> https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API

With the service worker up and running you can register a fetch event -> https://developer.mozilla.org/en-US/docs/Web/API/FetchEvent

With this you have full control of how resources are cached. Also note, the fetch event effects all resource loading, include HTML / Ajax & of course fetch.

Post a Comment for "Is It Possible To Cache A Broken Image?"