But what if you want the response to be cached but validated, or you want to set Cache-Control: max-age=0 header so that the request is validated end to end, similar to what happens when you click on browser refresh button.
The dojo toolkit provides a way to set headers while making xhrGet() call like this
dojo.xhrGet({
url: "<portlet:resourceURL/>",
headers: {
"Cache-control" :"max-age=0",
"PreventCache": "nocache"
},
load: function(data, ioargs){
dojo.byId("resourceResponse").innerHTML = data;
},
error: function(error,ioargs){
alert(error);
}
});
You can set headers by adding header field with map of name and values while making xhrGet() call. In my case i am setting Cache-Control and PreventCache header. and this is what happens when i make the request. If the resource is cached by browser the browser will not make a conditional get request to verify if it is changed. But it will add the headers like this
1 comment:
Thanks for info
Web Design Company in Bangalore
Website development in Bangalore
Post a Comment