web api instance property
FetchEvent: isReload property
Available in workers
The isReload read-only property of the
FetchEvent interface returns true if the event was
dispatched by the user attempting to reload the page, and false otherwise.
Pressing the refresh button is a reload while clicking a link and pressing the back
button is not.
Value
A boolean value.
Examples
self.addEventListener("fetch", (event) => {
event.respondWith(async () => {
if (event.isReload) {
// Return something
} else {
// Return something else
}
})();
});
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.