过时
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

非标
此特征是非标准的,且不在标准轨道中。不要在面向 Web 的生产站点中使用它:它不适用于每个用户。实现之间可能存在大的不兼容性,且行为将来可能改变。

摘要

onclose 特性为 WorkerGlobalScope interface represents an EventHandler to be called when the close event occurs and bubbles through the Worker .

This non-standard event handler was only implemented by a few browsers and has been removed from all or nearly all of them.

句法

self.onclose = function() { ... };
					

范例

The following code snippet shows an onclose handler set inside a worker:

self.onclose = function() {
  console.log('Your worker instance has been closed');
}
					

规范

This feature is no longer defined in any specifications.

浏览器兼容性

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
onclose 弃用 非标 Chrome 4 Edge 12 Firefox 3.5 — 50 IE Yes Opera 11.5 Safari 4 WebView Android 37 Chrome Android 40 Firefox Android 4 — 50 Opera Android Yes Safari iOS 5.1 Samsung Internet Android 4.0

图例

完整支持

完整支持

不支持

不支持

非标。预期跨浏览器支持较差。

非标。预期跨浏览器支持较差。

弃用。不要用于新网站。

弃用。不要用于新网站。

另请参阅

元数据

  • 最后修改: