获取 index.html 响应头 [英] Get index.html response headers
本文介绍了获取 index.html 响应头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
注意:事实证明这是重复的:在 JavaScript 中访问网页的 HTTP 标头
有没有办法获取 index.html 请求的请求头?例如,这是我点击 google.com
Is there a way to get the request headers for the index.html request? For example, this is a screenshot of me hitting google.com
我希望能够访问请求标头.这可能吗?
I would like to be able to get access to the Request Headers. Is this possible?
其他 javascript/css 资源呢?
What about for other javascript/css assets?
推荐答案
这取决于您如何请求该页面,如果您使用 javascript/jquery 通过 ajax 加载它,则可能:
It depends on how are you requesting that page, if you are loading it over ajax with javascript/jquery it is possible:
$.ajax({
type: 'GET',
url:'google.com',
success: function(resp){
console.log(resp.getAllResponseHeaders());
}
});
这篇关于获取 index.html 响应头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文