I know this question has been asked multiple times before, but the solutions posted are not working for me.
I have put the following in the <head>
tag, to no avail:
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="-1">
I also saw some mention about the onunload
attribute and the bfcache in browsers, so I added that to the <body>
tag, also to no avail.
The response headers from my server contain:
Cach开发者_StackOverflowe-Control max-age=0, private, must-revalidate
Would appreciate it if someone could point me in the right direction here - what am I doing wrong?
Answering my own question. As it turns out, setting the following response headers (as opposed to META
tags) worked for me:
Cache-Control private, no-store, max-age=0, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma no-cache
Expires Fri, 01 Jan 1990 00:00:00 GMT
If you're working in Rails like I am, you can do this easily by putting the following in an ApplicationController
before_filter
callback:
response.headers["Cache-Control"] = "private, no-store, max-age=0, no-cache, must-revalidate, post-check=0, pre-check=0"
response.headers["Pragma"] = "no-cache"
response.headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT"
Using the back button will use the cache as @kindall said. It really depends on what you don't want cached.
Instead of encouraging users from using the back button can you structure the page navigation so that the user can always get to where they want without having to use a back button?
The stuff you don't want cached can you load it dynamically via ajax?
You can reload the logged In page with reload() after the session is being terminated in the http() fun, this updates the local cache. Since your session has ended the reload will take you to the login page. Even if you press the browser back button the login page remains, because the local cache is updated.
精彩评论