Client interface represents an executable context such as a Worker ,或 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() .

方法

Client.postMessage()

Sends a message to the client.

特性

Client.id 只读

The universally unique identifier of the client as a string.

Client.type 只读
The client's type as a string. It can be " window" , " worker" , or " sharedworker" .
Client.url 只读

The URL of the client as a string.

规范

规范 状态 注释
服务工作者
The definition of 'Client' in that specification.
工作草案 初始定义。

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
Client Chrome 40 Edge 17 Firefox 44
44
Extended Support Releases (ESR) before Firefox 78 ESR do not support service workers and the Push API.
IE No Opera 27 Safari No WebView Android 40 Chrome Android 40 Firefox Android 44 Opera Android 27 Safari iOS No Samsung Internet Android 4.0
frameType Chrome 43 Edge 17 Firefox 44
44
Extended Support Releases (ESR) before Firefox 78 ESR do not support service workers and the Push API.
IE No Opera 30 Safari No WebView Android 43 Chrome Android 43 Firefox Android 44 Opera Android 30 Safari iOS No Samsung Internet Android 4.0
id Chrome 40 Edge ≤79 Firefox 44
44
Extended Support Releases (ESR) before Firefox 78 ESR do not support service workers and the Push API.
IE No Opera 27 Safari No WebView Android 40 Chrome Android 40 Firefox Android 44 Opera Android 27 Safari iOS No Samsung Internet Android 4.0
postMessage Chrome 45 Edge ≤79 Firefox 44
44
Extended Support Releases (ESR) before Firefox 78 ESR do not support service workers and the Push API.
IE No Opera 32 Safari No WebView Android 45 Chrome Android 45 Firefox Android 44 Opera Android 32 Safari iOS No Samsung Internet Android 5.0
type Chrome 60 Edge ≤79 Firefox 54 IE No Opera 47 Safari No WebView Android 60 Chrome Android 60 Firefox Android 54 Opera Android 44 Safari iOS No Samsung Internet Android 8.0
url Chrome 40 Edge ≤79 Firefox 44
44
Extended Support Releases (ESR) before Firefox 78 ESR do not support service workers and the Push API.
IE No Opera 27 Safari No WebView Android 40 Chrome Android 40 Firefox Android 44 Opera Android 27 Safari iOS No Samsung Internet Android 4.0

图例

完整支持

完整支持

不支持

不支持

实验。期望将来行为有所改变。

实验。期望将来行为有所改变。

见实现注意事项。

另请参阅

元数据

  • 最后修改:
  1. 服务工作者 API
  2. Client
  3. 特性
    1. frameType
    2. id
    3. type
    4. url
  4. 方法
    1. postMessage()
  5. Related pages for Service Workers API
    1. 缓存
    2. CacheStorage
    3. Clients
    4. ExtendableEvent
    5. FetchEvent
    6. InstallEvent
    7. Navigator.serviceWorker
    8. NotificationEvent
    9. PeriodicSyncEvent
    10. PeriodicSyncManager
    11. PeriodicSyncRegistration
    12. ServiceWorker
    13. ServiceWorkerContainer
    14. ServiceWorkerGlobalScope
    15. ServiceWorkerRegistration
    16. SyncEvent
    17. SyncManager
    18. SyncRegistration
    19. WindowClient

版权所有  © 2014-2026 乐数软件    

工业和信息化部: 粤ICP备14079481号-1