Stop JS caching
Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: General Discussion
Forum Description: General discussion and chat on any topic.
URL: https://forums.webwiz.net/forum_posts.asp?TID=15189
Printed Date: 31 March 2026 at 6:36pm Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com
Topic: Stop JS caching
Posted By: Gullanian
Subject: Stop JS caching
Date Posted: 22 May 2005 at 6:45pm
On my Fire fox extension I have the line:
<script type="application/x-javascript" src="http://www.c4sms.com/fireFox/getaddresses.asp" />
Basically if you are logged in it lists your addresses as a javascript
array so it can be manipulated and used in the rest of the extensions
code.
However, FireFox seems to cache it. This is not a script issue,
it works fine before the cache, then whatever you do it presents the
same values.
I put the lines:
Response.Expires = 60
Response.Expiresabsolute = Now() - 1
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"
In the JS file (as it is an ASP file), but Firefox still seems to cache it.
Any ideas what I can do? It's pretty important this is not cached.
|
Replies:
Posted By: Gullanian
Date Posted: 22 May 2005 at 6:50pm
Ah, found the answer in IRC, I should of known this one.
Just put a querystring at the end with date and time
EDIT:
Still some problems if someone could help. It doesn't like putting variables in script definition lines:
<script language="Javascript">
var currentTime = new Date()
var cacheControlVar = currentTime.getTime();
var scriptInclude = ('<script type="application/x-javascript"
src="http://www.c4sms.com/fireFox/getaddresses.asp?cachecontrol='+
cacheControlVar +'" />');
document.write(scriptInclude + "<BR><BR><BR>" + requestStatus);
</script>
Request status is a variable that should be pulled in from the included
script. Im basically trying to print a line that includes a JS
with a variable parameter.
|
|