如何禁用页面缓存?

时间:2023-02-09 20:17:32

In my web application I have a problem with the browser back button, so I used this code to disable caching,I cleared all the cache from the browser but it didn't work.

在我的Web应用程序中,我有浏览器后退按钮的问题,所以我使用此代码禁用缓存,我清除了浏览器中的所有缓存,但它没有工作。

// Set standard HTTP/1.1 no-cache headers.
response.setHeader("Cache-Control", "private, no-store, no-cache, must-revalidate");

// Set standard HTTP/1.0 no-cache header.
response.setHeader("Pragma", "no-cache");

//Proxies
response.setDateHeader("Expires", 0);

1 个解决方案

#1


I know it will sound silly but try to invalidate the cache and try again (ex: CTRL-F5 in your browser).

我知道这听起来很傻但是尝试使缓存失效并再试一次(例如:浏览器中的CTRL-F5)。

#1


I know it will sound silly but try to invalidate the cache and try again (ex: CTRL-F5 in your browser).

我知道这听起来很傻但是尝试使缓存失效并再试一次(例如:浏览器中的CTRL-F5)。