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" />