MDN self-hosted library · e01.org

FetchEvent: isReload property

Service Workers APIservice

Open notebook · 1 cells web-api-instance-property upstream source

Service Workers APIservice

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

See also