Reputation: 771
After accessing a particular url I need to clear the cache on closing the tab or reloading the url.
I am using the following META tags to clear the cache(in HEAD)
<meta http-equiv="Content-Type" content="**; charset=UTF-8"/>
<meta http-equiv="Cache-Control" content="private, no-cache, no-store, must-revalidate"/>
<meta http-equiv="Pragma" content="no-cache"/>
<meta http-equiv="Expires" content="0"/>
For a particular scenario I am opening the url http://***/1
in a browser tab.
When I open the same url http://***/1
in another new tab in the same browser window(without closing the previously opened tab), the cache is not getting cleared.
Can anyone please help me in fixing this?
EDIT: I donot want the user to clear the cache manually.
Upvotes: 0
Views: 290
Reputation: 8229
Try to set response headers for HttpServletResponse
in servlet class or directly on jsp page:
<%
response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
response.setHeader("Pragma", "no-cache");
response.setDateHeader("Expires", 0);
%>
Upvotes: 3