NavigationPreloadManager: setHeaderValue() method - Web APIs | MDN
Syntax
Parameters
value-
An arbitrary string value, which the target server uses to determine what should returned for the requested resource.
Return value
Exceptions
InvalidStateErrorDOMException-
There is no active worker associated with the registration to which this
NavigationPreloadManagerbelongs.
Examples
The code below demonstrates how the value might be set.
js
navigator.serviceWorker.ready
.then((registration) =>
registration.navigationPreload.setHeaderValue(newValue),
)
.then(() => console.log("Done!"))
.catch((e) =>
console.error(`NavigationPreloadManager not supported: ${e.message}`),
);
Specifications
| Specification |
|---|
| Service Workers Nightly # dom-navigationpreloadmanager-setheadervalue |