i want to know if it will effect the site to not unload javascript and css files, when other files are keep loading on the site. well im creating functionality like facebook with ajax, so i was wondering if i have to unload the javascript/css resource on new page call.
Little more explanation: ok when you go to facebook.com, it start loading the page in background with ajax. and if you click on any page/profile/section it will load the required css/javascript for it, but im not sure if they unload the required javascript, which no longer need on new request. so i was wondering, should i leave the javascript which was loaded previously or should i remove it, cause removing is not hard part, just keeping track might be little complex for a big site.
any pros/cons?
The only way you could “unload” javascript would be to unset the script objects created by the loaded script.
So if you script is:
You could technically “unload” it by doing something like:
But you’d have to be pretty tidy with your loaded script.. and there’s still the potential issue with event handlers still being attached to some elements of the dom.