Consider the following JavaScript code, with an animation library (i.e. scriptaculous) to boot.
window.onbeforeunload = function(event) {
document.body.fade();
}
Leaving the page is instantaneous and doesn't wait for the animation to complete. Even though everywhere I look people say JS doesn't support threads, something is running in parallel here, because it seems the one will not wait for the other. Am I right about the threads, and is there any way to achieve what I'm trying to do here?