So my javascript files are being cached. Originally I just had them in a script tag like so:
<script type='text/javascript' src='js/example.js'></script>
Now my understanding is that it is perfectly fine for browsers to cache GET
requests.
Since my application is in development still I can't allow this for now.
My second understanding about caching is that if the GET
query strings are different then it wouldn't see them as the same therefore not caching them, with this in mind I added this to my pages instead:
<script type="text/javascript">
window.onload = function () {
var s = document.createElement('script');
s.type = 'text/javascript';
s.src = "js/example.js?timestamp=" + new Date().getTime();
document.body.appendChild(s);
}
</script>
This loads the file fine coming up with something like:
<script type="text/javascript" src="js/example.js?timestamp=1369194644133"></script>
But somehow this is still being cached.
I also have cache disabled on my browser (Google Chrome) but its still happening.
To serve the files I am using IIS 7.5 and I have also disabled cache for the site on that as well.