在阅读了几个线程之后,我遇到了两个基本的解决方案。
一个涉及要求浏览器不要缓存 - > 使用 HTML 元标记 S1:
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv='expires' content="-1"/>
<meta http-equiv='pragma' content="no-cache"/>
它对我不起作用。
其他是在 URL 后面放随机数
S2:
<script language="javascript" src="./js/myJS.js?'+ Math.Random()*100+'"/>
这些适用于 Chrome 和 Mozilla,但由于某种原因,它们不适用于我在 IE 上。
有人知道另一种方法吗?
我无法将 S2 嵌入到脚本块中。如果可以做到,那么这可能会奏效。
<script>
document.write("<script language=\"javascript\" src=\"./js/myJS.js?'+ Math.Random()*100+'\"/>")
</script>