I could see a lot of articles explaining about "Cache-Control" when it is used as a response header. Could somebody explain me what is the impact when we use cache-control as a request header.
Here is the scenario I'm trying to solve.
In the environment I'm working,there is no way I can say not to cache the response in the response header. Everything is fine with this, but one of the requests doesn't need a cached response. This request is a synchronous ajax "GET" request. So,to make it not to use the cache I'm setting "Cache-Control" header in the request the following way.
var xhr = new XMLHTTPRequest();
xhr.open(..,...,false);
xhr.setRequestHeader("Cache-Control","no-cache");
xhr.send(null);
This is returning the response from the cache rather than making an explicit call to server. So how can I make an ajax call that skips the cache?
One common trick is to send a timestamp parameter:
xhr.open(..,... + "?now=" + new Date().getTime(), false);