1、解决静态页面(如.html)加载问题
本人使用的是springboot+前端静态页面
推荐方案,在controller中给需要跳转的静态文件添加时间戳
1 @Controller 2 public class IndexController { 3 @RequestMapping("/") 4 public String hello() { 5 Date date = new Date(); 6 return "redirect:index.html?v="+date.getTime(); 7 } 8 }
2、解决css与js样式表不加载的问题
解决方案一:
在页面header中加入以下内容:
1 <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" /> 2 <meta http-equiv="Pragma" content="no-cache" /> 3 <meta http-equiv="Expires" content="0" />
解决方案二(推荐):
在每次新版本变动后在静态文件后加入版本号:
1 <script type="text/javascript" src="js/index.js?v=201911251800" ></script> 2 <link rel="stylesheet" href="css/index.css?v=201911251800" />