Using JavaScript to invalidate the browser's cache
caching, css, javascript, sass
Solution
The simplest way is usually to add a unique parameter onto the url, I often just use a timestamp
var timestamp = (new Date()).getTime();
url += '?time=' + timestamp;
Just be careful if your requests already have parameters then you need to add `&time=' + timstamp` instead.
The browser can't cache the request because each request looks unique.
Problem
I'm doing a project in Django and using djangos-css (http://github.com/dziegler/django-css) and Sass (http://sass-lang.com/). The Sass files are served in development using django-css. I want to write a JavaScript routine that will every one second retrieve the CSS assets. The purpose of this is so that the designer can edit the Sass files, hit save, and see the result in the browser immediately without switching applications and hitting refresh. Basically I need a way for JavaScript to force the browser to re-download certain files without doing a page refresh. Is this possible?