这是一个实验中的功能
此功能某些浏览器尚在开发中,请参考浏览器兼容性表格以得到在不同浏览器中适合使用的前缀。由于该功能对应的标准文档可能被重新修订,所以在未来版本的浏览器中该功能的语法和行为可能随之改变。
Client
接口表示一个可执行的上下文,如Worker
或SharedWorker
。Window
客户端由更具体的WindowClient
表示。 你可以从Clients.matchAll()
和Clients.get()
等方法获取Client
/WindowClient
对象。
Methods
Client.postMessage()
- 向client发送一条消息。
Properties
Client.id
只读- 客户端的唯一通用标识符,字符串形式。
Client.type
只读- 客户端的类型,字符串形式。可能是"
window"
, "worker"
, 或 "sharedworker"。
Client.url
只读- 客户端的URL,字符串形式。
规范
Specification | Status | Comment |
---|---|---|
Service Workers Client |
Working Draft | Initial definition. |
浏览器兼容性
We're converting our compatibility data into a machine-readable JSON format.
This compatibility table still uses the old format,
because we haven't yet converted the data it contains.
Find out how you can help!
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | 40 | 44.0 (44.0)[1] | 未实现 | 27 | 未实现 |
type property |
60 | 54.0 (54.0) | ? | 47 | ? |
Feature | Android Webview | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | 40 | 40 | 44.0 (44.0) | 未实现 | 27 | 未实现 |
type property |
60 | 60 | 54.0 (54.0) | ? | 47 | ? |
- [1] Service workers (and Push) have been disabled in the Firefox 45 & 52 Extended Support Releases (ESR.)