My site runs on quite a bit of jQuery-based Javascript, and occasionally I'll receive a complaint from a reader that their browser goes into an infinite loop and throws a script timeout error, when they follow a link that takes them away from the page.
I'm assuming this has something to do with jQuery's removal of event handlers when the page is unloaded; i.e. this code in 1.2.6: // Prevent memory leaks in IE // And prevent errors on refresh with events like mouseover in other browsers // Window isn't included so as not to unbind existing unload events jQuery(window).bind("unload", function() { jQuery("*").add(document).unbind(); }); Today someone complained of seeing this script timeout in Firefox 3. Is there something I can do to prevent this? There are a lot of dynamic elements in the site, and event handlers are being installed on the fly, but I also use the unbind() method before replacing any HTML and installing new handlers -- so I'm pretty sure there aren't orphaned bits of event-bound HTML floating around. Any ideas are welcome...