Solved

How to refresh image cache?

Posted on 1998-09-04
10
387 Views
Last Modified: 2013-12-25
How can you require an image to be refreshed when a page is loaded?  I have a gif that is updated periodically but has the same filename.  I understand that images are cached separately so Reload won't cause the new gif to load.
0
Comment
Question by:jmallen
10 Comments
 

Author Comment

by:jmallen
ID: 1865669
Adjusted points to 100
0
 
LVL 10

Expert Comment

by:MasseyM
ID: 1865670
If the image created using CGI or something like that? if it is, add the date to the end of the filename (image080598.gif) this will then load everytime...


0
 

Expert Comment

by:kamyanlai
ID: 1865671
What browser do you use ?
This is important to refreshing the cache.
0
 
LVL 3

Expert Comment

by:vlad_impala
ID: 1865672
You could try using some META tags in your page to prevent caching of the page
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">  should stop the page being cached.
Alternatively you could put an expiry date on the page such as
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">

I think there may be some problems with Internet Explorer ignoring META tags so thius may not work for IE.

Vlad.
0
 
LVL 6

Expert Comment

by:ckayter
ID: 1865673
IE does not ignore Meta tags. You shouldn't have any problems using a nocache tag.

Colleen

0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Author Comment

by:jmallen
ID: 1865674
Not using cgi to create the image and the filename needs to remain the same.  Have already tried META tags (Expires and Pragma) which work for text but not for images.  The solution needs to work for *most* browsers.  Right now I'm attacking it with server-side javascript, but wanted to know if there was a more simple/elegant solution.
0
 
LVL 1

Expert Comment

by:Patricia080698
ID: 1865675
The best answer that I can give you is that you disable caching within your browser. for example, in netscape, (preferences) there is an option that lets you specify the size of your cache, if you disable it (put them both to 0 kb) that you will have no problem. Every time your pages load so do your images. It does not insert it in the cache directory. That should work. Best of luck.
0
 

Expert Comment

by:wsanchez
ID: 1865676
You could check out
   http://www.experts-exchange.com/topics/comp/www/images/Q.10076409

It's not exactly the same problem as yours but I think it is related to your question.
0
 

Author Comment

by:jmallen
ID: 1865677
This needs to be addressed on the server side (Netscape Enterprise 3).  I can't require everyone looking at this page to disable or empty their cache!  The problem arises because I am allowing a user permission to change the contents of an image file (in a directory with ACL set up for her permission), but *not* the contents of the HTML file (in a restricted directory) that links to it.  When the image file has been updated, a simple Reload will not cause the image to be reloaded as well.  The image filename must remain the same, because the HTML file linking to it will not be changed.
0
 
LVL 28

Accepted Solution

by:
sybe earned 100 total points
ID: 1865679
You have to change your HTML in the way MasseyM suggested. I am not sure why you have rejected his answer.

If your HTML is generated by ASP, then do something like:

<img scr="yourimage.gif?<%=Server.URLEncode(Now())%>">

CGI's should have similar functions.

If your page is plain HTML, then you have to use javascript (and it won't work with browser without javascript enabled:

<script>
var Now = new Date();
document.write("<img src='yourimage.gif?" + escape(Now) + "'");
</script>

Both will fool the browser, telling it's a different image everytime the page is (re)loaded, and will prevent the browser using the cached image.

0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
cookies analysis tools 2 67
Stupid git question 2 58
remove border from element 5 49
best platform for custom social media website and mobile app 2 53
Learn by example how to specify CSS selectors for Selenium WebDriver test automation software.
Read about why website design really matters in today's demanding market.
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now