For Servlet call :
response.setHeader("Cache-Control","no-cache");//HTTP 1.1
response.setHeader("Pragma","no-cache");//HTTP 1.0
response.setDateHeader("Expires", 0); //prevents caching at the proxy server
For Web Service call :
<%//Forcing no cache so browser hits the AJAX urls everytime else it will cache and show old data
response.setHeader("Cache-Control", "no-store"); //HTTP 1.1
response.setHeader("Pragma", "no-cache"); //HTTP 1.0
response.setDateHeader("Expires", 0); //prevents caching at the proxy server
%>
W3C web site has more about these tags. So next time you are AJAXing around, mind your cache!!
No comments:
Post a Comment
Thank you for your feedback