toastedDeli
toastedDeli

Reputation: 580

When would a client send a HTTP HEAD request?

As I understand, a HTTP HEAD request is the same as a HTTP GET request but the client only wants the metadata (i.e the usual response it would get from a GET request but without the message body).

What I'm struggling to understand is when would the browser request this? Is it triggered by a user action or some background work of the browser to work out what is on a webpage?

Upvotes: 2

Views: 2717

Answers (1)

Max Yaskov
Max Yaskov

Reputation: 342

The browser will send the HEAD method only if the XMLHttpRequest object is used.

var request = new XMLHttpRequest();
request.open('HEAD', 'url');

Upvotes: 0

Related Questions