任何现代浏览器都会发出HTTP HEAD请求吗? [英] Do any modern browsers ever issue an HTTP HEAD request?

查看:411
本文介绍了任何现代浏览器都会发出HTTP HEAD请求吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我理解HEAD请求是什么,以及它可以用于什么。任何标准的现代浏览器都会发送HEAD请求吗?如果是这样,在什么情况下?

I understand what a HEAD request is, and what it could be used for. Will any standard, modern browser ever send a HEAD request? If so, in what context?

推荐答案

浏览器将发送 HEAD 请求是否在 XMLHttpRequest 中明确请求,但我相当确定浏览器永远不会发送 HEAD 自愿要求。我的证据是Tornado Web服务器默认为返回错误 HEAD 请求我从未听说有人遇到与此相关的问题(甚至没有发现)。

A browser will send a HEAD request if that is explicitly requested in an XMLHttpRequest, but I'm fairly certain that the browser will never send a HEAD request of its own accord. My evidence is that the Tornado web server defaults to returning an error for HEAD requests and I've never heard of anyone running into problems related to this (or even being aware of it).

HEAD 主要是过时的恕我直言:在动态网站上,它不可能比 GET ,它通常可以替换为以下之一:

HEAD is mostly obsolete IMHO: on a dynamic web site it is unlikely to be significantly more efficient than a GET, and it can usually be replaced by one of the following:


  • 条件 GET with If-Modified-Since If-None-Match (用于缓存)

  • 部分获取,带范围标头(用于例如流媒体视频)

  • OPTIONS (用于CORS预检请求)

  • Conditional GET with If-Modified-Since or If-None-Match (used for caching)
  • Partial GET with Range header (used for e.g. streaming video)
  • OPTIONS (used for CORS preflight requests)

这篇关于任何现代浏览器都会发出HTTP HEAD请求吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆