如何避免浏览器自动缓存

使用meta标签

1
2
3
<meta http-equiv="Expires" content="0">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-control" content="no-cache">

设置响应头

1
2
3
response.setDateHeader("Expires",0); 
response.setHeader("Pragma","no-cache");
response.setHeader("Cache-Control","no-cache");
评论