NavigationPreloadManager.disable()
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
disable()
Return Value
Exceptions
InvalidStateErrorDOMException-
There is no active worker associated with the registration to which this
NavigationPreloadManagerbelongs.
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 function() {
if (self.registration.navigationPreload) {
// Disable navigation preloads!
await self.registration.navigationPreload.disable();
}
}());
});
Specifications
No specification found
No specification data found for api.NavigationPreloadManager.disable.
Check for problems with this page or contribute a missing spec_url to mdn/browser-compat-data. Also make sure the specification is included in w3c/browser-specs.
Browser compatibility
BCD tables only load in the browser