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. |
工作草案 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
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 |
完整支持
不支持
FetchEvent
client
clientId
isReload
navigationPreload
PreloadRequest
preloadResponse
replacesClientId
request
resultingClientId
缓存
CacheStorage
Client
Clients
ExtendableEvent
InstallEvent
Navigator.serviceWorker
NotificationEvent
PeriodicSyncEvent
PeriodicSyncManager
PeriodicSyncRegistration
ServiceWorker
ServiceWorkerContainer
ServiceWorkerGlobalScope
ServiceWorkerRegistration
SyncEvent
SyncManager
SyncRegistration
WindowClient