[Javascript] Auto reloading JS files on change?
Rees, Mark
Mark.Rees at astrazeneca.com
Mon Jun 2 07:52:48 CDT 2008
I have the following in an HTML file that is
echo'd to the browser via PHP code.
<script src="ajax/players.js"
type="text/javascript"></script>
But whenever this, and other, .js files are
modified the user must know to hit the refresh
button on his browser.
I've been looking for a way to reload the JS files
on changes, and I've come across the last-modified
header element, but not sure how to implement this.
-------
Assuming you have the above script element in a site-wide include file or similar, one option is to rename the js file when you change it - you can use a version number: for example players_105.js. If other applications need to access it that may not work well for you though.
More information about the Javascript
mailing list