Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to refresh image cache?

Posted on 1998-09-04
10
Medium Priority
?
408 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 

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 400 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
Ready to get certified? Check out some courses that help you prepare for third-party exams.
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…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

971 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