Reputation: 135
Folks! I have a problem, for example, user join on my page and do some actions, write comments, and push "Back" in Firefox, he looks old content (cache). I'm using Rails 2.3, but don't know, ho to fix it. I need that user push "back" in FF, he will see updated content, not from FF cache. Apologize for my english. :) Thank for advice.
Upvotes: 1
Views: 328
Reputation: 14227
for Rails 3 and 4 you can try this gem https://github.com/equivalent/no_cache_control
Upvotes: 0
Reputation: 477
You can prevent the browser cache by calling (before_filter :prevent_browser_cache ) the following code:
def prevent_browser_cache
headers["Pragma"] = "no-cache"
headers["Cache-Control"] = "must-revalidate"
headers["Cache-Control"] = "no-cache"
headers["Cache-Control"] = "no-store"
end
Upvotes: 2