更新时间:2023-01-29 19:28:22
如果它与调用函数位于同一服务器上,则可以使用XMLHttpRequest-
If it's on the same server as your calling function you can use XMLHttpRequest-
此示例不是异步的,但是您可以根据需要进行创建.
This example is not asynchronous, but you can make it so if you wish.
function fetchHeader(url, wch) {
try {
var req=new XMLHttpRequest();
req.open("HEAD", url, false);
req.send(null);
if(req.status== 200){
return req.getResponseHeader(wch);
}
else return false;
} catch(er) {
return er.message;
}
}
alert(fetchHeader(location.href,'Last-Modified'));