When server side code is updated (related to JavaScript) the old JavaScript files are served from cache.
I need a solution where the old JavaScript files get updated to their newer versions. Browser cache (related to JavaScript) need to be invalidated once the files on server are updated.
I have got the following solution to this problem.
var randomnumber=Math.floor(Math.random()*10000);
var scriptfile='http://www.whatever.com/myjs.js?rnd='+randnumber;
But I need to clear cache only when there is some update on the JavaScript files not on every reload of the page.