Invalidate the browser cache

Set the following response headers to invalidate any browser Cache.


response.setHeader("Pragma","no-cache"); 
response.setHeader("Cache-Control","no-cache, no-store, must-revalidate"); response.setHeader("max-age","0");  


Alternatively you can use the HTTP meta equivalent tags to do in HTML 

<meta http-equiv="Cache-Control" content="no-store,no-cache, must-revalidate,post-check=0, pre-check=0,max-age=0">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0"> 


Click Here for more options on cahce-control

2 comments:

  1. Where do I have to set these headers? Portal Config?

    ReplyDelete
    Replies
    1. Sorry for the late response, these should go into the jsp/servlet/portlet (whatever the component that sends response back to the browser)

      Delete