Accessing the web page's HTTP Headers in JavaScript

前端 未结 17 2677
日久生厌
日久生厌 2020-11-21 04:53

How do I access a page\'s HTTP response headers via JavaScript?

Related to this question, which was modified to ask about accessing two specific HTTP headers.

<
17条回答
  •  我寻月下人不归
    2020-11-21 05:27

    Using XmlHttpRequest you can pull up the current page and then examine the http headers of the response.

    Best case is to just do a HEAD request and then examine the headers.

    For some examples of doing this have a look at http://www.jibbering.com/2002/4/httprequest.html

    Just my 2 cents.

提交回复
热议问题