FetchEvent: respondWith() method
Baseline
Widely available
*
This feature is well established and works across many devices and browser versions. It’s been available across browsers since April 2018.
* Some parts of this feature may have varying levels of support.
Note: This feature is only available in Service Workers.
The respondWith() method of
FetchEvent prevents the browser's default fetch handling, and
allows you to provide a promise for a Response yourself.
In most cases you can provide any response that the receiver understands. For example,
if an <img> initiates the request, the response body needs to be
image data. For security reasons, there are a few global rules: