Form submission onbeforeunload in Firefox not working
<p>In IE9 the form "checkout" is submitted before the page unloads (but I seem to have inconsistent results (timing of page unload vs. form submission?)), but in Firefox, the RecordCart function works up until the document.checkout.submit(); line ... but in Firefox it won't seem to submit the form.</p>

<p>Any help on getting this to work in Firefox ... and in IE is this the best way to do this (as my results seem to vary in IE9, there may be a problem with the code)?I have a page with data items I want to record if someone leaves the page. I am using onbeforeunload like this:</p>

<pre><code>    &lt;script type="text/javascript"&gt;

    window.onbeforeunload = RecordCart;


    function RecordCart() {
         document.checkout.action = "shop_checkout.asp";
         document.checkout.submit();
    }

    &lt;/script&gt;
</code></pre>

<p>In IE9 the form "checkout" is submitted before the page unloads (but I seem to have inconsistent results (timing of page unload vs. form submission?)), but in Firefox, the RecordCart function works up until the document.checkout.submit(); line ... but in Firefox it won't seem to submit the form.</p>

<p>Any help on getting this to work in Firefox ... and in IE is this the best way to do this (as my results seem to vary in IE9, there may be a problem with the code)?</p>
