jquery - 获取 http 标头

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19440768/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 23:58:20  来源:igfitidea点击:

jquery - get http headers

javascriptjqueryhttp-headersmsisdn

提问by villager

How do you get the http headers passed on a page? Is this achievable via javascript/jquery? I'm looking into something like this: http://www.mulliner.org/pc.cgi

如何在页面上传递 http 标头?这可以通过 javascript/jquery 实现吗?我正在研究这样的事情:http: //www.mulliner.org/pc.cgi

回答by rodmjay

There is no api to get the headers for the current page. The best way to approach this is to make an ajax call to the current page and read them as described in this question.

没有 api 来获取当前页面的标题。解决此问题的最佳方法是对当前页面进行 ajax 调用并按照本问题中的描述阅读它们。

Accessing the web page's HTTP Headers in JavaScript

在 JavaScript 中访问网页的 HTTP 标头