Reputation: 11
I am making a full stack application using Django. I have some client-side Javascript written in a file called logic.js. I noticed that sometimes when I make changes in the logic.js file and then hit refresh in the browser, the browser's logic.js file doesn't change. However, if I open the site in another window, it gets the updated logic.js file. I am perplexed by this behavior of my browser (if it a browser problem). Why is this happening?
Upvotes: 1
Views: 1162
Reputation: 95
For local development, make sure to disable the cache in you browser to make sure it always requests new data from the local server.
Upvotes: 1
Reputation: 983
Yeah, that will happen. I usually add a version in the template like:
<script src="{{ STATIC_URL }}app/js/filename.js?v={{ VERSION }}"></script>
where version is changed whenever I release an update. This should force the browser to grab the updated file.
Upvotes: 0