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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Browser caching problem? 1

Status
Not open for further replies.

carmenMiranda

Programmer
May 22, 2003
47
GB
I have a dynamic text area which loads it's content from an external text file using LoadVars(). When I upload a new text file, some users don't see the new text until they manually clear their browser cache.

This obviously isn't ideal and rather defeats the object of updating the text file on a daily basis. If this is indeed a browser caching problem, is there any way I can force the browser to display the new text (maybe triggering a cache-clearance) using actionscript?
 
You can append a unique number to your LoadVars(), that should force the browser to check the server for the file rather than using the cached one...

Something like...

Code:
// set up the unique number from date...
d = new Date();
// always a unique number
kill = d.getTime();

// Then when loading the text file...
loadVariablesNum("nocache.txt?kill="+kill, 0);

// Or...

loadVarsText = new LoadVars();
loadVarsText.load("nocache.txt?kill="+kill);
...

You can't really test this locally, text file must be uploaded to the server, and tested online.



Regards. Affiliate Program - Web Hosting - Web Design
After 25,000 posts, banned on FK, but proud not to have bowed down to them!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top