On part of my new Intranet for work, I'm pulling images down from a remote server so people who don't have Internet access can view them (with permission of course ). This is working perfectly fine, however the image changes every 10 minutes (filename remains constant). The problem is that if there is an image with the same filename that is stored within the user's cache, the browser will load the image from cache instead of the new one. Is there a way to force the browser to ignore the cache and pull the new image? Javascript is fine, asp is prefered.
Use this If the page name is default.html Use this http://www.lol.com/default.html? That should bring a new page everytime. If it an ASP page, just set the response encoding level.
I thought of that, but it doesn't work with images. The page may be reloaded, but the images are being pulled from cache. I've also tried: <% Response.CacheControl = "no-cache" Response.AddHeader "Pragma", "no-cache" Response.Expires = -1 %> and changing the content expiration on the web site properties within IIS to expire immediately with no joy.
figured it out after losing a few clumps of hair. I was thinking about that question mark thing and tried something simple as follows: <img src="/cache/weather/radar.jpg?<%=left((replace((time()), ":", "")), 6)%>"> I figured that the since it's an image, the browser would ignore the ? and everything after it as far as displaying goes. Now, when the browser loads the image, it caches it as radar.jpg? and then it will put in the modified time - ie: radar.jpg?120543. That way eventhough it may be cached, it will pull the image from the server as it's not quite the same name. I just hope it downgrades to lower versions of IE.. Time will tell...
Looks like you've stumbled onto the answer I would have given The answer should be backwards compatable as images are referenced throught HTTP .. which (for IIS) can effectively distinguish an image from a page and ignore what in effect is a query string.