且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在用户注销后清除浏览器缓存以防止通过“返回"按钮访问私人信息

更新时间:2023-12-02 13:20:28

在应用程序控制器中使用下面的代码 .. 它对我有用.希望这会帮助你.谢谢!!

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

代码

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