如何禁用缓存阿贾克斯在Safari浏览器? [英] How to disable Ajax caching in Safari browser?
问题描述
我有一个问题,AJAX的缓存,这是在IE浏览器中的问题太多,但我固定它通过编写以下code。
I am having an issue with ajax caching, This was a problem in IE browser too but i fixed it by Writing the Following code.
response.setHeader("Cache-Control", "no-cache");
response.setHeader("expires","-1");
response.setHeader("pragma","no-cache");
但我看到Safari4.0基于MAC的缓存Ajax请求(我们有需求量的共同支持)。火狐狸从来就不是一个问题。对此过期我将其设置为-1,我看到很多地方将其设置为0或一些旧的日期从过去的。它会有所作为?
But I see Safari4.0 on MAC is Caching the Ajax request(We have a requirment to support this). Fire Fox never a problem. Regarding this "Expire" i am setting it to -1, i see lot of places it is set 0 or some old date from past. Will it make a difference?
推荐答案
发送有额外的参数与您的GET请求,这将永远是相同的,例如,当前的时间戳。是这样的:
Send an extra parameter with your GET request that will never be the same, for example, the current timestamp. Something like:
url = url + '&nocache=' + new Date().getTime();
这将prevent缓存。
This will prevent caching.
这篇关于如何禁用缓存阿贾克斯在Safari浏览器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!