[Javascript] Auto reloading JS files on change?
Roger Roelofs
rer at datacompusa.com
Mon Jun 2 14:19:36 CDT 2008
Mark,
On Jun 2, 2008, at 8:52 AM, Rees, Mark wrote:
> 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.
Have you looked at JSONP?
http://simonwillison.net/2005/Dec/16/json/
It basically works by letting you specify a function for the inserted
script to call so you can know when it has loaded and process any data
it contains. The recent version of jQuery has support built in for
this.
Roger
--
Roger Roelofs
Datacomp Appraisal Services
3215 Eaglecrest, NE
Grand Rapids, MI 49525
More information about the Javascript
mailing list