如何清除浏览器缓存用户注销通过“返回”按钮prevent获得私人信息后, [英] How to clear browser cache after user logout to prevent access to private info via 'Back' button

查看:153
本文介绍了如何清除浏览器缓存用户注销通过“返回”按钮prevent获得私人信息后,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

之后,如果他们打后退按钮,就可以回到他们在注销前的最后一页。

After a user logs out, if they hit the back button, they can go back to the last page they were on before logging out.

我的工作,该应用程序通常会在公用计算机上使用(库或计算机实验室,例如),我想从能够看到从previous用户会话什么prevent用户

The app I am working on will often be used on a public computer (library or computer lab, for example) and I'd like to prevent users from being able to see anything from previous user sessions.

我在Rails 3中,并制定,顺便说一句,虽然看上去这个问题会拿出任何框架或登录机制。

I'm on Rails 3 and Devise, btw, although it seems that this issue would come up with any framework or login mechanism.

时使用页眉/元标签禁止浏览器缓存解决方案?任何人都知道的宝石或教程,解决这个问题的?

Is the solution to use headers/meta-tags to disable browser-caching? Anybody know of a gem or tutorial that addresses this issue?

期待您的咨询。

推荐答案

使用中的应用程序控制器的下方code ..它为我工作。
希望这会帮助你。
谢谢!!

Use the below code in application controller .. it works for me. Hope this will help you. Thank you!!

code

before_filter :set_cache_buster

def set_cache_buster
   response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate"
   response.headers["Pragma"] = "no-cache"
   response.headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT"
end

这篇关于如何清除浏览器缓存用户注销通过“返回”按钮prevent获得私人信息后,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆