Stop Caching of Page in Local Client

Hi,

Got a web site with a few JSP pages. Is there a command I can place in the pages which will stop them from being cached in the user's web browser?

Thanks
KtoshniAsked:
Who is Participating?
 
bloodredsunCommented:
<%
      response.setHeader("Expires", "Sun, 7 May 1995 12:00:00 GMT");
        response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
        response.addHeader("Cache-Control", "post-check=0, pre-check=0");
        response.setHeader("Pragma", "no-cache");
%?
0
 
TimYatesCommented:
<%
        // Set to expire far in the past.
        response.setHeader("Expires", "Sat, 6 May 1995 12:00:00 GMT");
        // Set standard HTTP/1.1 no-cache headers.
        response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
        // Set IE extended HTTP/1.1 no-cache headers (use addHeader).
        response.addHeader("Cache-Control", "post-check=0, pre-check=0");
        // Set standard HTTP/1.0 no-cache header.
        response.setHeader("Pragma", "no-cache");
%>
0
 
TimYatesCommented:
heh
0
 
bloodredsunCommented:
Gotcha!!!

Mind you, you should get the points as I think that originally it was your code

;-)
0
 
TimYatesCommented:
>> I think that originally it was your code

hehe...  I *think* I swiped it off a web page somewhere ;-)

...

yup:  http://www.pushlets.com/src/nl/justobjects/pushlet/util/Servlets.java.html

;-D
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.