编程语言
首页 > 编程语言> > Java中禁止浏览器开启缓存的方法命令

Java中禁止浏览器开启缓存的方法命令

作者:互联网

响应头里添加禁止浏览器缓存的内容

 

Cache-Control: no-cache, no-store, must-revalidate

Pragma: no-cache

Expires: 0

其中,Cache-Control用于HTTP1.1(包括1.1)以上;Pragma用于HTTP1.0;Expires用于代理服务器缓存。





Java(JSP)的命令

response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");

response.setHeader("Pragma", "no-cache");

response.setHeader("Expires", "0");

标签:缓存,浏览器,no,Cache,cache,response,Pragma,Java,Expires
来源: https://www.cnblogs.com/wu-sheng/p/15526086.html