--- title: GlobalEventHandlers.onclose slug: Web/API/GlobalEventHandlers/onclose tags: - API - HTML DOM - Property - Reference translation_of: Web/API/GlobalEventHandlers/onclose ---
{{ApiRef("HTML DOM")}}

送至視窗的 close event 的處理器(handler)。(不支援 Firefox 2 及 Safari)

語法

window.onclose = funcRef;

參數

範例

window.onclose = resetThatServerThing;

規範

規範 狀態 備註
{{SpecName('HTML WHATWG','webappapis.html#handler-onclose','onclose')}} {{Spec2('HTML WHATWG')}}  

瀏覽器相容性

{{CompatibilityTable}}
Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support {{CompatVersionUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatNo}}
Feature Android Android Webview Chrome for Android Firefox Mobile (Gecko) Firefox OS IE Mobile Opera Mobile Safari Mobile
Basic support {{CompatUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatNo}}