我有一个php驱动的应用程序与javascript和许多jax调用。我的应用程序在firefox中是最新的。但是当我在internet explorer-8或类似版本中运行它时,我的ajax调用被缓存在我的浏览器中,所以我不能用ajax调用输出最新的信息,而是使用驻留在浏览器缓存中的旧数据来处理ajax调用的结果。
I have tried lots of possible options as listed below
1.) I added following meta tag in header files
<meta http-equiv='cache-control' content='no-cache'>
<meta http-equiv='expires' content='0'>
<meta http-equiv='pragma' content='no-cache'>2.)我添加了以下php代码
header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
header('Pragma: no-cache');但以上两种方法仍然没有解决我的问题,即,请任何人帮助我禁用缓存internet explorer时,我的应用程序运行,以便它有可能获得最新的信息。
提前感谢
发布于 2011-08-05 17:37:58
以某种方式使每个AJAX请求具有唯一性。这将阻止IE缓存响应。
例如,如果您的普通AJAX查询URL是www.mysite.com/ajax.php?dog=cat,那么在每个AJAX请求中添加一个唯一的querystring参数:
www.mysite.com/ajax.php?dog=cat&queryid=1
每次发出AJAX请求时都会递增该参数,希望这能帮到您。
https://stackoverflow.com/questions/6954189
复制相似问题