note 22093 deleted from function.rand by vincent
| From: | vincent@php.net | Date: | Thu, 11 Sep 2003 13:26:07 +0000 |
| Subject: | note 22093 deleted from function.rand by vincent | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-56148@lists.php.net to get a copy of this message | ||
Note Submitter: andrew@heyotwell.com
----
Quick and dirty way to help avoid image caching in the browser: use rand() to append a random number
to the end of the img src element:
echo <img src=\"blah.gif?\".rand(1,999)."width=\"100\"
height=\"100\">
browsers will see
<img src="blah.gif?453" width="100" height="100">
They ignore the stuff past the ?, but it's enough to make the request different from the
previous one, meaning the browser will get the image off the server again.
Not 100% reliable, but what is?