javascript清除缓存的方法:1、在html里head区添加相关代码;2、清除临时缓存;3、通过【$.ajaxSetup】设置属性【cache:false】。

本教程操作环境: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如何清除缓存的详细内容,更多请关注模板之家(www.mb5.com.cn)其它相关文章! |