This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
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.
var reloaded = FetchEvent.isReload
A Boolean.
self.addEventListener('fetch', function(event) {
event.respondWith(
if (event.isReload) {
//Return something
} else {
//Return something else
};
);
}); | Specification | Status | Comment |
|---|---|---|
| Service Workers The definition of 'isReload' in that specification. | Working Draft | Initial definition. |
| Desktop | ||||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
| Basic support | 45 | 17 | 44
|
No | 32 | No |
| Mobile | |||||||
|---|---|---|---|---|---|---|---|
| Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
| Basic support | 45 | 45 | 17 | 44 | 32 | No | 5.0 |
Promise
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/FetchEvent/isReload