|  | Posted by "Richard Lynch" on 06/17/01 11:24 
On Thu, August 18, 2005 2:38 am, R. Ragunathan wrote:>  how to clear the contents of cache in Internet explorer
 > using php.If any one finds the solution do reply.
 
 The people saying "you can't" are technically correct, of course.
 
 You can't clear out the cache on a user's hard drive, because that
 would give you FAR too much power over their computer.
 
 Though I'm not sure how different that is from them running Windows in
 the first place. :-)
 
 The answer that you can send headers to avoid caching of content are
 kind of sort of correct, except that various browsers, servers, AOL
 Servers (enough unlike other servers to be their own category), and
 various other caching systems *WILL* cache your stuff, no matter what
 combination of standard, non-standard, and outright stupid headers you
 send out.
 
 There is ALWAYS somebody who thinks they have a right to cache your
 content, no matter how WRONG they are.
 
 One trick I frequently use is to simply embed a RANDOM element in a URL.
 
 For example:
 http://example.com/dynamic_image.php
 will get turned into:
 
 http://example.com/dynamic_image/847347372634581/dynamic_image.jpg
 
 EG:
 http://example.com/dynamic_image/<?php echo mt_rand()?>/dynamic_image.jpg
 [that was supposed to be all one line]
 
 The image will still get cached, but since you never use that URL
 again, you don't really need to worry about it.
 
 This makes IE's cache completely useless.
 
 Well, okay, it was already completely useless, but it's a different
 KIND of uselessness.
 
 Note that in the above URL, "dynamic_image" is the actual PHP script,
 the random number is ignored by the script, and the dynamic_image.jpg
 is there simply to "fool" the browser.
 
 Maybe if everybody did this, MS would realize how broken their
 cache-handling is and fix it... Nah.  They'd just break it even worse.
 
 --
 Like Music?
 http://l-i-e.com/artists.htm
  Navigation: [Reply to this message] |