用AJAX远程获取文件Header信息,下面的例子演示如何获取test.txt文件的最后修改时间:
<script language="javascript" type="text/javascript">
    var XMLHttp = null;
    if (window.XMLHttpRequest)
        XMLHttp = new XMLHttpRequest();
    else if (window.ActiveXObject)
        XMLHttp = new ActiveXObject("Microsoft.XMLHTTP");
    if (XMLHttp) {
        XMLHttp.open("HEAD", "test.txt", true);
        XMLHttp.onreadystatechange = function() {
            if ((XMLHttp.readyState == 4) && (XMLHttp.status == 200)) {
                alert("Last-Modified: " + XMLHttp.getResponseHeader("Last-Modified"))
            }
        }
        XMLHttp.send(null);
    }
</script>

相关文章:

  • 2022-12-23
  • 2022-02-23
  • 2021-07-07
  • 2021-08-12
  • 2022-12-23
  • 2022-01-06
  • 2022-02-09
  • 2021-08-30
猜你喜欢
  • 2022-12-23
  • 2021-08-15
  • 2022-12-23
  • 2021-11-16
  • 2022-12-23
  • 2022-01-30
  • 2022-12-23
相关资源
相似解决方案