Disable browser cache

I have implemented a REST service and I am using a webpage as a client. There are some javascript functions on my page that execute the same HTTP request to the REST server several times and process the responses.

My problem is that the browser caches the first response and does not respond to it, sends the following requests.

Is there a way to get the browser to execute all requests without caching? I am using Internet Explorer 8.0

thank

+3
source share
3 answers

Not sure if this can help you, but sometimes I add a random parameter to the URL of my request to avoid caching.

So, instead of:

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

I'll use:

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

, random . .

+8

. IE, . JS- , (, jQuery cache:false AJAX)

+7

, , ; REST, , ( , ), , , .

, , GET URI ( DOM, , XMLHttpRequest). IE, , , -; , .

Firefox , , , !

. " !". , , . , , .

. , IE , , Firefox , , .

, ( , , , ), setTimeout , , , .

, - . , .

, -, , GETting , POSTing . REST POSTING, GET.

This might mean that in balance, the THIS SPANTA approach to add random things to query strings is the way to go. It really depends.

+2
source

Source: https://habr.com/ru/post/1769735/


All Articles