replacesClientId 只读特性在 FetchEvent interface is the id 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.

句法

var myReplacedClientId = fetchEvent.replacesClientId;
					

A DOMString .

范例

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

规范

规范 状态 注释
服务工作者
The definition of 'replacesClientId' in that specification.
工作草案 初始定义。

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
replacesClientId Chrome 不支持 No Edge 不支持 18 — 79 Firefox 65 IE 不支持 No Opera 不支持 No Safari 不支持 No WebView Android 不支持 No Chrome Android 不支持 No Firefox Android 65 Opera Android 不支持 No Safari iOS 不支持 No Samsung Internet Android 不支持 No

图例

完整支持

完整支持

不支持

不支持

另请参阅

元数据

  • 最后修改: