Skip navigation
findnetworkingevents
Currently Being Moderated

Preventing cached page history from being visible

Aug 17, 2012 6:40 AM

Tags: #browser #cache

I am working on site where potentially two different users could login to the same browser without it having been closed.

 

This can allow the second user to use the back button and see cached pages belonging to the first user. I can't find a way of preventing the second user from seeing the previous users cached history.

 

I know it is possible, what is the best way to achieve this? 

 
Replies
  • Currently Being Moderated
    Aug 17, 2012 6:52 AM   in reply to findnetworkingevents
     
    |
    Mark as:
  • Currently Being Moderated
    Aug 20, 2012 7:58 PM   in reply to rae_k

    Here are some headers that I usually throw on any page where I do not want to cache

     

    <cfheader name="expires" value="#now()#">

    <cfheader name="pragma" value="no-cache">

    <cfheader name="cache-control" value="no-cache, no-store, must-revalidate">

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 21, 2012 5:48 AM   in reply to findnetworkingevents

    If you are also using session variables you may want to read this about Ending a session

    Of course that assumes the user actually performs some logout step.  Without the browser being closed all requests will use the same session as far as ColdFusion is concerned.  Be careful!

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 21, 2012 9:40 AM   in reply to findnetworkingevents

    NP, glad it worked.

     

    I have never had any cross browser issues with the cf headers, but let me know if you come across any and i will do my best to help.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 21, 2012 11:33 AM   in reply to Little_Mike

    All,

     

    Little_Mike is incorrect.  Those headers have proved inefficient on many occasions, depending on the browser the user is using.  The two fixes that I have found to be foolproof to never worry about caching, are these:

     

    1.  You use a <cfset Sleep(5000)> at the top of the page.  This will cause the browser and the server to have enough time to catch up to the latest version of the page, and not revert back to a cached version.

     

    2.  Use a cflocation to the current page.  This will essentially reload the page, and all new information will be available on the page.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 21, 2012 12:03 PM   in reply to Little_Mike

    All,

     

    Little_Mike is definitely disseminating incorrect ColdFusion information.

     

    Mike blindly throws out a bunch of cfheader tags with reckless abandon, seemingly unconcerned about the cross-browser effects.

     

    Clearly, the appropriate solution in these circumstances is to use the cross-browser compatible tag <cfcontent> as follows:

     

    <cfcontent reload="true" content="refresh" page="reload">

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 22, 2012 6:01 AM   in reply to jerseycat10

    I am interested to know where you have used that code jerseycat10?  None of those attributes that you have listed can be used with the cfcontent tag.  I have used the same cfheader tags that Little_Mike listed for years. They work.

     

    Here is the CF9 documentation for the cfcontent tag: http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461 172e0811cbec22c24-7c82.html

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 22, 2012 6:56 AM   in reply to Miguel-F

    Miguel,

     

    My co-workers are trolling me, lol.  You can ignore them.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points