Reputation: 1740
What does the browser do when a web page is going to be closed?
How does it deal with the loaded components(css js flash etc.). What is going to be cached?
Upvotes: 1
Views: 228
Reputation: 250972
Caching is decided as items are loaded, not when they are disposed - so an item will be in the cache before the page is unloaded.
When you navigate away from a page, the browser will call the events:
And then
It will then attempt to end any processes in use on the page, such as flash videos. Different browsers handle this in different ways as for some browsers the flash plugin runs under the same process as the browser and in others they run it under its own process.
Upvotes: 1
Reputation: 25137
I'm not exactly sure if this is what you're asking due to the grammar of the question, but if you are asking how to run some code when a web page is being closed or navigated away from in a browser, you can either bind to the JavaScript window.onunload event, or window.onbeforeunload if you want to possibly cancel the event.
See some documentation for onunload or onbeforeunload (the latter not being supported by all browsers).
Upvotes: 0