JS 如何清除页面缓存

JavaScript011

JS 如何清除页面缓存,第1张

1.动态页面:index.asp?id=....

2.使用jquery,$.ajaxSetup({cache : false })

3.在html里的head标签中加

<meta http-equiv ="proma" content = "no-cache"/>

<meta http-equiv="cache-control" content="no cache" />

<meta http-equiv="expires" content="0" />

另外一种:

<html http-equiv="proma" content="no-cache"/>

<html http-equiv="content-type" content="no-cache , must-revalidate"/>

<http http-equiv="expires" content=" Wed , 26 Feb 1997 08:21:57 GMT"/>

另外 ,在提交信息时,总是出现旧的内容,此时就应该考虑是本地浏览器缓存的原因了。

清空临时缓存的方法:

<body onload ="javascript : document.yourFormName.reset()">

办法①改完js文件后,在js路径后加一个参数,每次改完js文件后,参数改变一下,如src="js路径?v=1.1"改成src="js路径?v=1.2";

办法②在src里的路径加系统时间参数:t=system_time(),即src="js路径?t=system_time()"