Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to ensure client has latest scripts..? 1

Status
Not open for further replies.

tcstom

Programmer
Aug 22, 2003
235
GB
I run ASP.NET intranet applications which use a lot of client-side Javascript all located in external .js files. If I make a Javascript change I can't guarantee my users are running the latest script (since these files are cached by the browser) so I'm always sending out a message to ask users to clear out temp internet files or refresh the relevant page. Is there any way to instruct a client browser to obtain the latest version of a script when required?
 
Use your server-side code to append a timestamp after the file name when you load the script in your HTML, the browser will treat it as a request to a different file and won't use the cached version:
Code:
<script type="text/javascript" src="scripts/util.js[b]?timestamp=2008-01-31[/b]"></script>

Never be afraid to share your dreams with the world.
There's nothing the world loves more than the taste of really sweet dreams.

Webflo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top