function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Atul GuptaAtul Gupta site vf page cache problem

I have a visualforce page that is exposed on site publicly.

I've used cache = false attribute in <apex:page> tag, if I update anything in the page and try to view the site again in the same browser, I don't see the updated page. 
It shows me the old one before the update.

I'm using bootstrap in my vf page.

I've also tried these meta tags in the head section of the page, but still not able to get it working.
<meta http-equiv='cache-control' content='no-cache'></meta>
<meta http-equiv='expires' content='0'></meta>
<meta http-equiv='pragma' content='no-cache'></meta>

This is a major issue, as page will be pulling ever changing data.
Andy BoettcherAndy Boettcher
Your browser's cache can override these settings - can you crank your browser's settings back to "Check on every reload"?
Atul GuptaAtul Gupta
Andy, thanks for the reply. I can do this browser setting for myself but my users who will be actually seeing the page won't be able to make these changes in their browsers as the users can be anyone. The page will be exposed to public as public site.

Can, there be anything done in the code of the page, make a meta tag or some javascript, that wipes out the cache of the page on exit, or doesn't save it in the first place.

I even tried by cache="true" and putting a very short expiry time, but that too didn't help.
Hi Atul,
        I tried to reproduce your issue but couldn't. My browser is not caching any page. Here in order to prevent such cacheing issue you can do one thing which salesforce does for static resources. It builds new url everytime static resource is updated.
Here is code which can help you.
Page :
<apex:page controller="CachedPageController" action="{!pageLoad}">
  <!-- Begin Default Content REMOVE THIS -->
  This is your new Page. Which is supposed to get cached.
  <!-- End Default Content REMOVE THIS -->
Its controller:
public with sharing class CachedPageController {
        public PageReference pageLoad(){
            System.debug('Value is -->'+ApexPages.currentPage().getParameters().get('lastModified'));
            if(ApexPages.currentPage().getParameters().get('lastModified')==null ||
                   ApexPages.currentPage().getParameters().get('lastModified') == ''){            
                PageReference page = new PageReference('/apex/CachedPage?lastModified='+[Select Id,Name, LastModifiedDate FROM ApexPage where Name = 'CachedPage'][0].LastModifiedDate.getTime());
                return page;
            return null;
Here basically we are trying to reproduce new url so that browser will not take it from cache.
Approve this as a solution if this helps. Also this is workaround not exact solution which you are looking for. As you have tried cache option which comes by as atribute then this is way to go .

Atul GuptaAtul Gupta
Thanks KMForce. Let me try this, will get back to you.