When you leave an html page, all timers are gone. All variables are gone, The DOM is gone.No need for the unload event.
The unload event still exists and it still works, sometimes. There are only some things that can be done inside an unload event, and they have to be done quickly. AND under some circumstances, unload may not fire at all.
AJAX is one of those things that you probably can’t get away with in an unload handler.
There is no work-around. Other than to write code that does not rely on unload.