您的位置:首页 > Web前端 > JavaScript

JS 如何清除页面缓存

2015-03-19 18:19 295 查看
缓存有利于加快页面的加载速度,是实现高效web的一种方法,但是,有时,我们需要让页面不缓存,例如,升级,这样我们需要在页面中或者服务器做一些处理。

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()">
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: