I can't trigger the unload event in Chrome
<p>This code runs fine on Firefox, <strong>but I can't make the unload event work on Chrome</strong> anymore. Did Chrome stop supporting the unload event?</p>

<p>This is my code:</p>

<pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;&lt;/title&gt;

&lt;script type="text/javascript" src="../jquery/jquery.js"&gt;&lt;/script&gt;

&lt;script type="text/javascript"&gt;

    function pageHidden(evt) { alert("Are you sure 1?"); } //WORKS ON FIREFOX BUT NOT IN CHROME
    window.addEventListener("pagehide", pageHidden, false);

    window.onunload = function () { alert("Are you sure 2?"); } //TRIGGERS ON LOAD NOT ON UNLOAD

    $(window).unload(function () { //WORKS ON FIREFOX BUT NOT IN CHROME
        alert("Are you sure 3?");
    });

&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
TEST WEBSITE
&lt;a href="http://www.iamawesome.com"&gt;external link&lt;/a&gt;
&lt;/body&gt; 
&lt;/html&gt;
</code></pre>

<p>How can I get the unload event to work in Chrome?</p>

<p>Thanks!</p>

<hr>

<p><strong>ANSWER:
Don't test the unload event with alerts ;)</strong></p>
