I am currently trying to download several js files asynchronously, so that they cannot block the rest of the website. I basically followed the descriptions found here:
Asynchronous Javascript
From the point of view of non-blocking loading the javascript file, this works fine, but I had a problem with the fact that the javascript file is cached and remains cached even if I change the content (also doing shift-reload helps nothing).
My current script loading code is as follows:
(function() {
function xx_async_load() {
var xx = document.createElement('script');
xx.type = 'text/javascript';
xx.async = true;
xx.src = 'http://myserver.de/myjs.js';
var el = document.getElementsByTagName('script')[0];
el.parentNode.insertBefore(xx, el);
}
if (window.addEventListener) {
window.addEventListener('load', xx_async_load, false);
} else if (window.attachEvent){
window.attachEvent('onload', xx_async_load);
}
})();
If I call the code inside "xx_async_load" directly and change myjs.js, the changes become recognizable, but if I load it through the onload event, it always remains cached, and the changes are never recognized.
- , ( Opera, FF IE )?
: "" Operas Dragonfly, JS , , , .
EDIT2: , . , . ( ). .