[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 252
  • Last Modified:

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
0
Ktoshni
Asked:
Ktoshni
  • 3
  • 2
2 Solutions
 
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

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now