Preventing page caching in Opera

Forums » Opera for Windows/Mac/Linux » Opera browser

You need to be logged in to post in the forums. If you do not have an account, please sign up first.

Go to last post

13. April 2010, 19:47:25

surg42

Posts: 1

Preventing page caching in Opera

I am trying to prevent Opera from caching pages with no luck. Could someone let me know what the secret is to get this to work. Here are the following headers that I am using. Thanks!


rsp.addHeader("Cache-Control", "max-age=1");
rsp.setHeader("Cache-Control", "no-cache");
rsp.setHeader("Pragma", "no-cache");
rsp.setDateHeader("Expires", "-1");
rsp.addHeader("Cache-Control", "no-store");
rsp.addHeader("Cache-Control", "must-revalidate");
rsp.addHeader("Cache-Control", "private");

29. April 2010, 19:08:16

iamrpandia

Posts: 1

Even i face the same issue. I believe, Somebody from Opera has to help us. It might be a bug in Opera.

If user clicks browser back button and it goes to previos page(cached page). Though i set cache-control as No-cache. I don't want user to click back button. I just added the following line in my jsp file inside <script></script> tag. It worked. It might be useful to you
function noBack(param){
window.history.forward();
alert(param);
}
//noBack("call from noback inline method");
window.onload=noBack("call from onload method");
window.onpageshow=function(evt){if(evt.persisted)noBack("call from onpageshow method")}
window.onunload=function(){void(0)}

Forums » Opera for Windows/Mac/Linux » Opera browser