Client
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since April 2018.
Note: This feature is only available in Service Workers.
The Client
interface represents an executable context such as a Worker
, or a SharedWorker
. Window
clients are represented by the more-specific WindowClient
. You can get Client
/WindowClient
objects from methods such as Clients.matchAll()
and Clients.get()
.
Instance methods
Client.postMessage()
-
Sends a message to the client.
Instance properties
Client.frameType
Read only-
The client's frame type as a string. It can be
"auxiliary"
,"top-level"
,"nested"
, or"none"
. Client.id
Read only-
The universally unique identifier of the client as a string.
Client.type
Read only-
The client's type as a string. It can be
"window"
,"worker"
, or"sharedworker"
. Client.url
Read only-
The URL of the client as a string.
Specifications
Specification |
---|
Service Workers # client-interface |
Browser compatibility
BCD tables only load in the browser