FetchEvent.client

This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for the proper prefixes to use in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the spec changes.

Deprecated
This feature has been removed from the Web standards. Though some browsers may still support it, it is in the process of being dropped. Do not use it in old or new projects. Pages or Web apps using it may break at any time.

The FetchEvent.client read-only property returns the Client that the current service worker is controlling.

Note: This feature has been deprecated, with its functionality replaced by FetchEvent.clientId and Clients.get(). See this Github issue for discussion/background.

Syntax

JavaScript
var myClient = FetchEvent.client;

Value

A Client object.

Example

JavaScript
self.addEventListener('fetch', function(event) {
  console.log(event.client);
​});

Specifications

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

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 40.0 44.0 (44.0) Not supported 24 Not supported
Feature Android Android Webview Firefox Mobile (Gecko) Firefox OS IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support Not supported ? 44.0 (44.0) (Yes) Not supported ? Not supported 44.0

See also

License

© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/api/fetchevent/client

API Client Deprecated Experimental Expérimental FetchEvent Property Reference Référence Service Workers Workers