Get to know MDN better
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.
This is the event type for fetch events dispatched on the service worker global scope. It contains information about the fetch, including the request and how the receiver will treat the response. It provides the event.respondWith() method, which allows us to provide a response to this fetch.
Event ExtendableEvent FetchEventCreates a new FetchEvent object. This constructor is not typically used. The browser creates these objects and provides them to fetch event callbacks.
Inherits properties from its ancestor, Event.
FetchEvent.clientId Read onlyThe id of the same-origin client that initiated the fetch.
FetchEvent.handled Read onlyA promise that is pending while the event has not been handled, and fulfilled once it has.
FetchEvent.isReload Read onlyReturns true if the event was dispatched by the user attempting to reload the page, and false otherwise.
FetchEvent.preloadResponse Read onlyA Promise for a Response, or undefined if this fetch is not a navigation, or navigation preload is not enabled.
FetchEvent.replacesClientId Read onlyThe id of the client that is being replaced during a page navigation.
FetchEvent.resultingClientId Read onlyThe id of the client that replaces the previous client during a page navigation.
FetchEvent.request Read onlyThe Request the browser intends to make.
Inherits methods from its parent, ExtendableEvent.
FetchEvent.respondWith()Prevent the browser's default fetch handling, and provide (a promise for) a response yourself.
ExtendableEvent.waitUntil()Extends the lifetime of the event. Used to notify the browser of tasks that extend beyond the returning of a response, such as streaming and caching.
This fetch event uses the browser default for non-GET requests. For GET requests it tries to return a match in the cache, and falls back to the network. If it finds a match in the cache, it asynchronously updates the cache for next time.
| Service Workers Nightly # fetchevent-interface |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Aug 31, 2024 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.