Forum Moderators: open
The client page and remote resource is all in the same domain.
I use snifer catch browser's data.I found that:
The first time,IE really send request,
but secend time,IE use cache,did not send.
The resource is often change and big,
i need use cache normally,update it when it changed.
So i put the If-Modified-Since in the request header.
My code:
<script>
function getResource(url){
var req = new XMLHttpRequest();
req.open("GET",url, false);
req.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=UTF-8");
req.setRequestHeader("If-Modified-Since",#);//Here # need to set a date string like 'Sun, 11 Oct 2009 05:32:53 GMT'
req.send("");
return req.responseText;
}
</script>
I'm don't know how to get the url's lastmodified date.It is in the system cache.
Thank you for help :)
Last-modified I can get it after request.
Can i get the url's lastmodified when the browser is just open.(I have not request yet,but i visited,i think it is in the system cache)
When we visit a page like "http://www.#*$!.com/a,html"
If i visited,IE will add 'If-Modified-Since' in the request automaticly.
I'm doult that can we get and add it manually in javascript?