禁用浏览器缓存 [英] Disable browser cache

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

问题描述

我实现了一个REST服务,我正在使用一个网页作为客户端。
我的页面有一些javascript函数,它们对REST服务器执行多次相同的http get请求并处理回复。

I implemented a REST service and i'm using a web page as client. My page has some javascript functions that performs several times the same http get request to REST server and process the replies.

我的问题是浏览器缓存第一个回复而不是实际发送以下请求..

My problem is that the browser caches the first reply and not actualy sends the following requests..

是有一些方法可以强制浏览器执行所有请求而无需缓存吗?
我正在使用Internet Explorer 8.0

Is there some way to force the browser execute all the requests without caching? I'm using internet explorer 8.0

谢谢

推荐答案

不确定它是否可以帮到你,但有时候,我在我的请求的URL中添加了一个随机参数,以避免被缓存。

Not sure if it can help you, but sometimes, I add a random parameter in the URL of my request in order to avoid being cached.

所以不要:

http://my-server:8080/myApp/foo?bar=baz

我将使用:

http://my-server:8080/myApp/foo?bar=baz&random=123456789

of当然, random 的值对于每个请求都是不同的。您可以使用当前时间(以毫秒为单位)。

of course, the value of the random is different for every request. You can use the current time in milliseconds for that.

这篇关于禁用浏览器缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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