如何用 HTML 以程式設計方式清除瀏覽器快取?


你可以使用以下元標籤告訴瀏覽器不要快取你的頁面 -

<metahttp-equiv = 'cache-control' content = 'no-cache'>
<metahttp-equiv = 'expires' content = '0'>
<metahttp-equiv = 'pragma' content = 'no-cache'>

此外,嘗試以下操作: 將一個引數/字串附加到指令碼標籤中的檔名。當檔案更改時更改它。

<scriptsrc = "newfile.js?version = 1.0.0"></script>

然後,下次更新檔案時,只需更新版本,即

<scriptsrc = "newfile.js?version = 1.0.1"></script>

更新於: 01-06-2020

2K+ 次瀏覽

開啟你的 職業生涯

透過完成課程獲得認證

開始
廣告