NavigationPreloadManager: disable() method
The disable() method of the NavigationPreloadManager interface halts the automatic preloading of service-worker-managed resources previously started using enable() It returns a promise that resolves with undefined.
The method may be called in the service worker's activate event handler (before the fetch event handler can be called).
Syntax
Parameters
Return value
A Promise that resolves with undefined.
Exceptions
InvalidStateError DOMException
-
There is no active worker associated with the registration to which this NavigationPreloadManager belongs.
Examples
The code below shows how to disable preloading, after first using ServiceWorkerRegistration.navigationPreload to test that it is supported.
addEventListener("activate", (event) => {
event.waitUntil(
(async () => {
if (self.registration.navigationPreload) {
await self.registration.navigationPreload.disable();
}
})(),
);
});
Specifications
Browser compatibility
|
Desktop |
Mobile |
|
Chrome |
Edge |
Firefox |
Internet Explorer |
Opera |
Safari |
WebView Android |
Chrome Android |
Firefox for Android |
Opera Android |
Safari on IOS |
Samsung Internet |
disable |
59 |
18 |
99 |
No |
46 |
15.4 |
59 |
59 |
99 |
43 |
15.4 |
7.0 |
See also