I have updated an image called heart.jpg on my website.
How do I make sure that the new one displays when a user re-visits my website, rather than the old one they have in their cache?
Tks,
I have updated an image called heart.jpg on my website.
How do I make sure that the new one displays when a user re-visits my website, rather than the old one they have in their cache?
Tks,
JeevesBond posted this at 21:08 — 20th February 2007.
He has: 3,710 posts
Joined: Jun 2002
You might find a way to do this, although it's not worth the effort. I've found that browsers can be reasonably intelligent about using their cache. One way to 'fool' them into updating is use a different filename for the image, then--as long as the browser gets the new version of your page--it will use the new image.
The file name would be something like: heart02.jpg, or heartnew.jpg Hope this helps.
a Padded Cell our articles site!
andy206uk posted this at 12:29 — 22nd February 2007.
He has: 1,754 posts
Joined: Jul 2002
I wonder if this would work:
<img src="filename.jpg?r=<?= time() ?>" with="50" height="50" alt="etc" />'I used something similar to prevent caching of a dynamically generated css file once and it worked a treat...
Andyk
Blog of a Web Designer
Give a man a fish and you feed him for a day. Teach him to use the Net and he won't bother you for weeks.
Bansaw posted this at 14:49 — 22nd February 2007.
They have: 20 posts
Joined: Sep 2006
Thanks,----- are you calling a function here time() ....is it something in your header?
ACJavascripts posted this at 00:12 — 23rd February 2007.
He has: 11 posts
Joined: Feb 2007
<? time(); ?> is a php function...
If you want to use Javascript you will need to make a function that will either create a random number and attach it to the end of the image, or create an array that will randomly select one to show.
ACJavascripts.com - Free Cut and Paste Javascripts
SimplyProgram.com - Personal Blog
CYWebmaster.com - Webmaster Forum (re-designing)