• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Automatically clearing cached version of your site.


NoisyShaun

Junior Member
#1
Hey all!

I have made some changes to one of my sites.
I noticed on a windows XP (IE6) (aaagh!) machine that I had to clear IE’s Cache for the changes to take effect (Shift + F5) even after refreshing the page.
Is there a way to make my site’s pages automatically clear the cached version itself when it is loaded in IE? (or any other browser, however I didn’t have this issue on my Mac which was running firefox.)

Thanks!

:)
 
C

chrismitchell

Guest
#2
I think that a cache has to be cleared at the computer .. I don't know of any way to do it via any sort of code (other than C# and I think computers would treat it like a virus) I will have a think about it more.. :)
 

openmind

Senior Member
#3
You have got some cache control meta-tags:
HTML:
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
HTTP 1.1. Allowed values = PUBLIC | PRIVATE | NO-CACHE | NO-STORE.
Public - may be cached in public shared caches
Private - may only be cached in private cache
no-Cache - may not be cached
no-Store - may be cached but not archived The directive CACHE-CONTROL:NO-CACHE indicates cached information should not be used and instead requests should be forwarded to the origin server. This directive has the same semantics as the PRAGMA:NO-CACHE.
Clients SHOULD include both PRAGMA:NO-CACHE and CACHE-CONTROL:NO-CACHE when a no-cache request is sent to a server not known to be HTTP/1.1 compliant.
Also see EXPIRES.
Note: It may be better to specify cache commands in HTTP than in META statements, where they can influence more than the browser, but proxies and other intermediaries that may cache information.
Source: Useful HTML Meta Tags - cache, no-cache, robots, refresh, content, keywords, description, expires, author, etc.
 

openmind

Senior Member
#7
You can also do it programattically:

ColdFusion:
PHP:
<cfheader name="expires" value="#now()#"> 
<cfheader name="pragma" value="no-cache"> 
<cfheader name="cache-control" value="no-cache, no-store, must-revalidate">
PHP:
PHP:
  Header('Cache-Control: no-cache');
  Header('Pragma: no-cache');
ASP:
PHP:
<% Response.CacheControl = "no-cache" %>
  <% Response.AddHeader "Pragma", "no-cache" %>
  <% Response.Expires = -1 %>
JSP:
PHP:
<%
  response.setHeader("Cache-Control","no-cache");
  response.setHeader("Pragma","no-cache");
  response.setDateHeader ("Expires", 0);
  %>
And finally with a dead badger :)
 

openmind

Senior Member
#12
The flushdns command is to renew the IP location of a site such as when the name servers are changed. It won't prevent or clear a cached version of a website being stored in the browser cache :)
 

NoisyShaun

Junior Member
#13
Thanks all for your replies guys!

-Openmind, Thanks for the snippet of code -


<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">

When you say about google not caching it, can that impact on the rankings, or will it just mean when you visit google's cached version of the page it will be blank?

Thanks again!