My page开发者_开发百科 needs to know when the cache a included javascript file will expire, to retrieve it again.
The XMLHTTPRequest object has a getResponseHeader
method you can call:
// The following script:
var client = new XMLHttpRequest();
client.open("GET", "test.txt", true);
client.send();
client.onreadystatechange = function() {
if (this.readyState == 2) {
alert(client.getResponseHeader("Expires"));
}
}
精彩评论