FetchEvent.replacesClientId

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The replacesClientId read-only property of the FetchEvent interface is the id of the client that is being replaced during a page navigation.

For example, when navigating from page A to page B replacesClientId is the ID of the client associated with page A. It can be an empty string when navigating from about:blank to another page, as about:blank's client will be reused, rather than be replaced.

Additionally, if the fetch isn't a navigation, replacesClientId will be an empty string. This could be used to access/communicate with a client that will imminently be replaced, right before a navigation.

Syntax

var myReplacedClientId = FetchEvent.replacesClientId;

Value

A DOMString.

Example

self.addEventListener('fetch', function(event) {
  console.log(event.replacesClientId);
});

Specifications

Specification Status Comment
Service Workers
The definition of 'replacesClientId' in that specification.
Working Draft Initial definition.

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
replacesClientIdChrome No support NoEdge Full support 18Firefox Full support 65IE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoEdge Mobile ? Firefox Android Full support 65Opera Android No support NoSafari iOS No support NoSamsung Internet Android No support No

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown

See also

Document Tags and Contributors

Contributors to this page: mdnwebdocs-bot, chrisdavidmills
Last updated by: mdnwebdocs-bot,