[英]Can I get via javascript the HTTP expires header of a HTTP resource?
我的页面需要知道缓存中包含的javascript文件何时过期,然后再次检索它。
The XMLHTTPRequest object has a getResponseHeader
method you can call: XMLHTTPRequest对象具有可以调用的
getResponseHeader
方法 :
// 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"));
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.