IE9缓存动态页面 [英] IE9 caching dynamic pages

查看:124
本文介绍了IE9缓存动态页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个动态的Web应用程序(IIS7上运行),它工作在所有主要浏览器很好,除了IE9。看来,这几乎缓存的一切,这导致了相当多的问题,如

I'm developing a dynamic web application (running on IIS7), it works fine in all the major browsers, except IE9. It seems, that it caches practically everything, and that leads to quite many problems, like


  • 经常变化的内容保持不变

  • 用户访问授权的内容,那么招牌出来,然后试图回到安全的内容,并从缓存中!
  • 得到它

我已经试过禁用缓存,

<meta http-equiv="Expires" CONTENT="0">
<meta http-equiv="Cache-Control" CONTENT="no-cache">
<meta http-equiv="Pragma" CONTENT="no-cache">

但至今没有运气...

but no luck so far...

推荐答案

您大量使用AJAX的?确保每个AJAX请求是唯一的,否则IE9将成为该请求响应的缓存版本。

Are you making heavy use of AJAX? Make sure each AJAX request is unique, otherwise IE9 will serve up a cached version of the request response.

例如,如果你的AJAX请求URL通常是这样的:
http://www.mysite.com/ajax.php?species=dog& ;名称=菲

For example, if your AJAX request URL normally looks like: http://www.mysite.com/ajax.php?species=dog&name=fido

相反,一个独特的价值添加到每个请求,所以IE不只是使用缓存的响应。最简单的方法做,在JavaScript是,每次增加一个变量,你提出一个要求:

Instead, add a unique value to each request so IE doesn't just use the cached response. The easiest way to do that in Javascript is a variable that increments each time you make a request:

var request_id = 0;

var request_url = "http://www.mysite.com/ajax.php?species=dog&name=fido&request_id="+request_id;
request_id++;

这篇关于IE9缓存动态页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆