FetchEvent: resultingClientId property

فهرست فصل‌ها دانلود آرشیوناشر

MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونه‌کد

{{APIRef("Service Workers API")}}{{AvailableInWorkers("service")}}

The **resultingClientId** read-only property of the {{domxref("FetchEvent")}} interface is the {{domxref("Client.id", "id")}} of the {{domxref("Client", "client")}} that replaces the previous client during a page navigation.

For example, when navigating from page A to page B resultingClientId is the ID of the client associated with page B.

If the fetch request is a subresource request or the request's [destination](/en-US/docs/Web/API/Request/destination) is report, resultingClientId will be an empty string.

Value

A string.

Examples

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

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also

  • Using Service Workers
  • Service workers basic code example
  • Using web workers