<head> <meta charset="utf-8"> <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate"/> <meta http-equiv="Pragma" content="no-cache"/> <meta http-equiv="Expires" content="0"/> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta content="black" name="apple-mobile-web-app-status-bar-style"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0,user-scalable=no"> <link rel="icon" href="./favicon.ico" type="image/x-icon"/> <meta name="format-detection" content="telephone=yes"/> <title>xxx</title> </head>
https://blog.csdn.net/u012375924/article/details/82806617 詳情解說
在 index.html 頁面前面加 meta 標簽,注意:記得加上,我就是忘記加上了,一直測試不過。
1 <meta http-equiv="pragram" content="no-cache"> 2 <meta http-equiv="cache-control" content="no-cache, no-store, must-revalidate"> 3 <meta name="viewport" content="width=device-width,initial-scale=1.0">
但是把打包好的index.html放到服務器里去的時候,index.html在服務器端可能是有緩存的,這需要在服務器配置不讓緩存index.html
nginx 配置如下:
location = /index.html {
add_header Cache-Control "no-cache, no-store";
}