Search code examples
htmlhttppingtracking

What is the response to an HTML ping request


I have learned, that HTML anchor tags can also sport a ping resource url like

<a href="https://example.com" ping="http://tracking.example.com/" >Website</a>

This will asynchronously send a post request to the ping's target.

But what is the ping target supposed to respond with?

  • An HTML page on it's own?
  • A resource of some form?
  • Nothing?
  • And with what status code?

What should the browser do with the response, if any?

  • Just discard?
  • Log it?

Solution

  • The ping targets response does not matter at all. source

    User agents must ignore any entity bodies returned in the responses. User agents may close the connection prematurely once they start receiving a response body.

    So you can send an empty 204 No Content response.