aboutsummaryrefslogtreecommitdiff
path: root/files/es/web/api/windoweventhandlers
diff options
context:
space:
mode:
Diffstat (limited to 'files/es/web/api/windoweventhandlers')
-rw-r--r--files/es/web/api/windoweventhandlers/onunload/index.html46
1 files changed, 46 insertions, 0 deletions
diff --git a/files/es/web/api/windoweventhandlers/onunload/index.html b/files/es/web/api/windoweventhandlers/onunload/index.html
new file mode 100644
index 0000000000..111f87edf2
--- /dev/null
+++ b/files/es/web/api/windoweventhandlers/onunload/index.html
@@ -0,0 +1,46 @@
+---
+title: window.onunload
+slug: Web/API/WindowEventHandlers/onunload
+translation_of: Web/API/WindowEventHandlers/onunload
+original_slug: Web/API/GlobalEventHandlers/onunload
+---
+<p>{{ ApiRef() }}</p>
+<h3 id="Summary" name="Summary">Test Summary</h3>
+<p>The unload event is raised when the document is unloaded.</p>
+<h3 id="Syntax" name="Syntax">Syntax</h3>
+<pre class="eval">window.onunload = <em>funcRef</em>;
+</pre>
+<ul>
+ <li><code>funcRef</code> is a reference to a function.</li>
+</ul>
+<h3 id="Example" name="Example">Example</h3>
+<pre>&lt;html&gt;
+&lt;head&gt;
+
+&lt;title&gt;onunload test&lt;/title&gt;
+
+&lt;script type="text/javascript"&gt;
+
+window.onunload = unloadPage;
+
+function unloadPage()
+{
+ alert("unload event detected!");
+}
+&lt;/script&gt;
+&lt;/head&gt;
+
+&lt;body&gt;
+&lt;p&gt;Reload a new page into the browser&lt;br /&gt;
+ to fire the unload event for this page.&lt;/p&gt;
+&lt;p&gt;You can also use the back or forward buttons&lt;br /&gt;
+ to load a new page and fire this event.&lt;/p&gt;
+&lt;/body&gt;
+&lt;/html&gt;
+</pre>
+<h3 id="Notes" name="Notes">Notes</h3>
+<p>Note that using this event handler in your page prevents Firefox 1.5 from caching the page in the in-memory bfcache. See <a href="/En/Using_Firefox_1.5_caching" title="En/Using_Firefox_1.5_caching">Using Firefox 1.5 caching</a> for details.</p>
+<p>Browsers equipped with pop-up window blockers will ignore all window.open() method calls in onunload event handler functions.</p>
+<h3 id="Specification" name="Specification">Specification</h3>
+<p>{{ DOM0() }}</p>
+<p>{{ languages( {"zh-cn": "zh-cn/DOM/window.onunload" } ) }}</p>