Reputation: 126
I recently took over updating a website. When I tried to change the homepage, I found that the domain.com/index.html was updated appropriately, but that domain.com itself still showed the old version of the page. After some time, and without me changing anything, eventually domain.com started showing the new version of the page.
My initial idea was that this had to do with my browser caching the old homepage, but after doing some Googling I learned that browsers should check for updates (at least by default) before loading any cached paged.
Does anyone know why this occurred?
Upvotes: 1
Views: 668
Reputation: 4336
Webpage caching is of general behavior in most browsers unless changed by the user, the following code will always make a new request and ignore any stored cache of the defined Webpage
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
Place that inside your <head></head>
, also just to note this doesn't always work in all versions of IE since the page hasn't filled the 64K buffer on load before the Pragma
comes into play, thus meaning the page becomes cached, to ensure non-caching you can simply add another line
<META HTTP-EQUIV="Expires" CONTENT="-1">
Upvotes: 2