jQuery的阿贾克斯的缓存选项不会在Firefox和Chrome的工作? [英] The cache option of jQuery .ajax doesn't work in Firefox and Chrome?

查看:177
本文介绍了jQuery的阿贾克斯的缓存选项不会在Firefox和Chrome的工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经设置选项'缓存:真,但缓存似乎只能在IE浏览器,而不是Firefox和Chrome。那是一个已知的问题?

I have already set the option 'cache: true', but the cache seems only work in IE, but not in Firefox and Chrome. Is that a known issue?

推荐答案

缓存选项不是一个特殊的缓存jQuery的维护,所以也许这是一个有点名不副实。

The cache option isn't a special cache that jQuery maintains, so maybe it's a bit of a misnomer.

  • 缓存:假追加时间戳的URL被请求,所以它的力量浏览器抢一个新的副本,它更多的是缓存断路器。
  • 缓存:真正的 什么也不做,原生浏览器缓存剩下要做的一切它会在这里做
  • cache: false appends a timestamp to the URL being requested, so it forces the browser to grab a fresh copy, it's more of a cache-breaker.
  • cache: true does nothing, the native browser caching is left to do whatever it's going to do here.

这不是一个jQuery具体的事情的话,那只是如何浏览器的不同选择缓存响应或不。 如果你的缓存头被设置正确的告诉浏览器的的缓存,那么它应该。然而,IE喜欢缓存地狱的请求,即使没有头的指示做......的这是的可能的行为,你所看到的。如果这是你想要虽然beahior,缓存控制头(见上面的链接)添加到您的网页,你想缓存在其他浏览器也是如此。

It's not a jQuery specific thing at all, it's just how different browsers choose to cache a response or not. If your cache headers are set correctly telling the browser to cache it, then it should. However, IE likes to cache the hell out of requests even when there are no header instructions to do to...that's likely the behavior you're seeing. If it's the beahior you want though, add the cache control headers (see the link above) to your pages you want cached in other browsers as well.

这篇关于jQuery的阿贾克斯的缓存选项不会在Firefox和Chrome的工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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