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
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
