We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

image reload

ficken
ficken asked
on
Medium Priority
306 Views
Last Modified: 2013-12-25
I have a web cam that is set to save a new image over the same filename every ten seconds. They way I have the web page set now with just an img tag to reference the image does not work well, as when one hits reload or refreshes the page the same old image is always called up due to the browser caching the image. Is there a way to make the latest version of the image load whenever the page is refreshed? I have tried using the <meta http-equiv=pragma content=no-cache> but this tag does not seem to work. Is there another way to make this work with all or most browsers? I would even be interested in any scripts that might provide the effect of pulling up the latest version of the image.
Comment
Watch Question

Commented:
Hi ficken!

I really enjoyed researching your question, because getting HTML pages refreshed is always an interesting and challenging exercise.  In this case, I think you're close to exactly where you want to be with the code you have.

However, I've been using another META choice for quite a while now, and I think it is real neat and it will do the job you're looking for.  Let's do this in two steps:

Step 1:  Make sure that the META element you place in your HTML document is in the HEAD element...META will only work there.

Step 2:  Place this code (once again, in the HEAD element):

           <META HTTP-EQUIV="REFRESH" CONTENT=10>

Try it, you'll like it!  Then, be sure to save the code.  You'll undoubtedly find it useful many times in the future.

Best regards...

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
I have tried this meta tag as well, but refreshing the page does not make the browser reload the image, since the old image and new image have the same name and file size, the browser assumes they are the same and just loads the old image from cache...any other suggestions?

Commented:
Yup.  Try this construction:

     <META HTTP-EQUIV="REFRESH"CONTENT="10;URL=http://www.xxx.yyy/etc.">

This construction is supposed to fetch directly from the URL.  Will your (or somebody else's) browser intercept that and go to cache anyway?  Can't tell you.  Try it and see how it works on your browser.

Like I said earlier, "... always an interesting and challenging exercise."!!!

Best regards...

 

Commented:
Hi Again!

I just noticed something.  Your question didn't happen to mention which browser you're using.  That's important.  The function we're talking about here (called 'Client Pull') is only..repeat..only supported with Netscape (after 2.0, I believe) and Internet Explorer browsers.  If you're using one of these, what we're suggesting (and what you did in the first place, for that matter) should be working.

If your browser is 'something else', try your code somewhere that you can view it on one of those two browsers.  It should work just fine.  

If you're 'stuck' with a brand 'X' browser, then I'm afraid you're limited to manual refresh.  That's not really too bad you know.  Just tell your user something like:  This image (object, whatever) needs to be periodically refreshed.  To refresh, just click here.  Make the words 'click here' a 'hotspot' to your URL.

Sorry I didn't notice this in the first place.  Perhaps, if I had, we'd have saved some time.  Hope this clarifies things for you, and good luck in your Authoring pursuits!

We really do appreciate your using Expert's Exchange.  Your confidence in our ability to address your questions is highly valued, and we hope you'll feel inclined to use our services again whenever we can be of assistance.

Best regards...

Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.