I want to load my javascript files after the page is loaded and make sure that they are being cached.
This question has been asked and answered a lot but they all suggest loading it with jQuery ($.getScript
) while one of the files I want to load is the jQuery itself and I can not use jQuery. there are some options like:
(function(){
var newscript = document.createElement('script');
newscript.type = 'text/javascript';
newscript.async = false; //as I'm going to execute some functions
//after this I want to make sure that the
//script is fully loaded
newscript.src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js';
(document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]).appendChild(newscript);
})();
but I'm not sure if they are cached or not. and Is there a way to fire an event when dynamically loading script is done?
`?
– Ry- Jun 21 '15 at 20:58`.
– Ry- Jun 21 '15 at 21:11