05
2019
12

让HTML页面不缓存,每次都访问最新数据

方法一:在<head>标签里增加如下meta标签。

<meta http-equiv="Expires" content="0"><meta http-equiv="Pragma" content="no-cache"><meta http-equiv="Cache-control" content="no-cache"><meta http-equiv="Cache" content="no-cache">

方法二:给请求的路径中加一个随机数。

function toURL(){ var url="index.html"+"?a="+Math.random(); window.open(url);}