When I'm clicking logout button I want the browser cache to be cleared.
I'm trying to clear the browser cache, using the following code:
if(uri.equals("/SciArchive/logout.sci"))
{
HttpSession session=req.getSession(false);
res.setHeader("Cache-Control","no-cache");
res.setHeader("Cache-Control","no-store");
res.setDateHeader("Expires", 0);
res.setHeader("Pragma","no-cache");
if(session!=null)
{
session.invalidate();
rd=req.getRequestDispatcher("/home.jsp");
}
rd.forward(req,res);
return;
}
When back button is pressed in browser window after logout, I need the browser not showing the previous page.
When I'm clicking back button it shows the previous page, after clicking forward button in browser window it shows document expired.
Please give me suggestions to clear this error!