Monday, May 31, 2010

Clear Broswer Cache for J2ee

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Cache-control" content="no-cache"/>
<meta http-equiv="Cache-control" content="no-store"/>
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="expires" content="0">

<%
            response.setHeader("Cache-Control", "no-cache");
            response.setHeader("Pragma", "no-cache");
            response.setDateHeader("Expires", 0);
            response.setHeader("Cache-Control", "no-store");
%>
</head>

2 comments:

  1. On my Header MenuBar, I have ---

    Home, Profile, Invite , Blog, Search, Gallery and logout tabs.

    All are inaccessible till a user logs in.So a login Session is created and all the inaccessible pages can be accessed by the user now. But the problem is -----

    when i cleck the Brower BACK Button, it shows me the Relogin page(index page), Yet my Session is maintained, cause, i can still access those other pages now.

    Also when i logout, if i click the back button, I can view (not access) the previous page of the logged in user, but this time the session is lost, cause clicking on the other tabs results in "No permission page"

    i have simply used ---
    try {
    request.getSession().invalidate();
    response.sendRedirect("home.jsp");
    }


    i have used the Meta tags -- no-cache and no-store and expires -1. still no good.

    I also tried to disable the browser back button by using history.forward().But that is not a good technique.

    Any suggestion would do, Still learning....

    ReplyDelete
  2. Hi mate,

    Are you facing any problem, are whats your expectation ?


    ReplyDelete