So I'm trying to implement code to prompt the user before they navigate away from the page while an upload is in progress. I attempted to use onbeforeunload and the prompt worked but it appears to kill the upload (at least in FF3). Is there a way to make unbeforeunload work or an alternative that doesn't involve putting special code on every link I have on the page?

Here is my code, though I plan to make it more robust to actually detect what state the swfu object is in:

onbeforeunload_handler = (function() {
  //Called whenever document.unload
  //Also called by some AJAX framework functions
  if (document.swfu != null)
    return 'All uploading videos will be LOST. Are you sure you want to leave?';
});

window.onbeforeunload = onbeforeunload_handler;

swfu is a global instance declared in the main page as such:

document.swfu = new SWFUpload(settings);