FetchEvent:resultingClientId 屬性

Baseline 已廣泛支援

此功能已成熟,並可在多種裝置和瀏覽器版本上執行。自 2022 年 9 月起,所有瀏覽器都已支援此功能。

注意:此功能僅在 Service Workers 中可用。

resultingClientIdFetchEvent 介面的一個只讀屬性,它表示在頁面導航期間替換前一個客戶端的 clientid

例如,當從頁面 A 導航到頁面 B 時,resultingClientId 是與頁面 B 關聯的客戶端的 ID。

如果抓取請求是子資源請求,或者請求的 destinationreport,則 resultingClientId 將是一個空字串。

字串。

示例

js
self.addEventListener("fetch", (event) => {
  console.log(event.resultingClientId);
});

規範

規範
Service Workers
# fetch-event-resultingclientid

瀏覽器相容性

另見