IE浏览器下Ajax 请求,缓存bug
解决方法,
1,以后面加一个随机参数 或者使用jquery $.ajax中不带缓冲的加载方法,其原理也是在后面加了一个随机参数
2,在服务器 response中设置 header即可。
public void ProcessRequest (HttpContext context) {
context.Response.AddHeader("Pragma", "no-cache");
context.Response.AddHeader("Cache-Control", "no-cache");
context.Response.AddHeader("Expires", "0");
context.Response.ContentType = "text/plain";
Random r = new Random();
String str=r.Next(1000).ToString();
context.Response.Write(str);
}
经测试,IE8下正常。
参阅 php 织梦CMS include common.func.php
function AjaxHead()
{
@header("Pragma:no-cache\r\n");
@header("Cache-Control:no-cache\r\n");
@header("Expires:0\r\n");
}
- 上一篇:dz 批量设置发贴数为0
- 下一篇:Dz论坛Session丢失问题