本教程操作环境:windows7系统、javascript1.8.5版,dell g3电脑。
javascript清除缓存的方法:
1,在html里head区添加代码:
<meta http-equiv="pragma" content="no-cache" /><meta http-equiv="content-type" content="no-cache, must-revalidate" /><meta http-equiv="expires" content="wed, 26 feb 1997 08:21:57 gmt"/>
2,清除临时缓存
<body onload="javascript:document.yourformname.reset()">
3,jquery ajax清除浏览器缓存的两种方法:
1)、通过$.ajaxsetup 设置属性cache:false,让ajax不调用浏览的缓存。
jquery.ajaxsetup ({cache:false})
2)、在ajax的url后加上随机串来避免浏览缓存,例如:$.ajax({url:'test.php?'+parseint(math.random()*100000)})缓存。
相关免费学习推荐:javascript学习教程
以上就是javascript如何清除缓存的详细内容。
