You are hereweb tech
web tech
Neat hack: forcing browsers to refresh script source javascript in your CMS
A handy hack, force browsers of visitors to your website to refresh their javascript cache, handy when you are doing extensive upgrades to your site and you really must ensure everyone is running the latest javascript from your site.
this code works in drupal, but could be easily tweaked for other CMS's or PHP frameworks.
it just appends a "/foo.js?$file_mod_time" to any script sources that are parsed to it, so as soon as you change the file, this ensures any browsers will try to grab the latest version.
function append_js_time($matches) {
if($matches[1]{0} == '/') {