I am using the Angularjs Framework, and i update my js controllers a lot, and i want to know how i can force the broweser to get the new/updates js files and not pull them up from cache.
If anyone can help me out that will be great thanks!
I am using the Angularjs Framework, and i update my js controllers a lot, and i want to know how i can force the broweser to get the new/updates js files and not pull them up from cache.
If anyone can help me out that will be great thanks!
The easiest way to get an un-cached file is to append a string of sorts to the end of the file. This could be a version number, timestamp or some random string.
PHP:
<?php
echo '<script src="/js/file.js?t=' . time() . '"></script>';
JavaScript:
<script>
document.head.appendChild(
document.createElement('script')
).src='/js/file.js?t=' + (new Date().getTime());
<script>
For an uncached file every time, change the string on every request.
For an uncached file occasionally, use something like a version number, or an md5 version number.