I have a web page with a Javascript file added dynamically. After changing the script (adding allert or smth like this) I reload the page, and push a trigger button for adding the script, but the browser uses the old one (chached). Tried it in chrome and IE. Other scripts (that are not added dynamically) reload well.
Here is the function that loads the script:
function addScript (s)
{
script = document.createElement('script');
script.type = 'text/javascript';
script.src = s;
document.getElementsByTagName('head')[0].appendChild(script);
script.onload=function ()
{
switch (s)
{
case 'some address':
functionInTheNewFile(); break;
default: break;
}
};
}
What is wrong here?