The HTML ping attribute
Following a link with a ping attribute sends a POST request to each http or https URL in it. The request body is PING, and a Ping-To header names the link's target. Firefox is the one major browser that doesn't send these requests unless a user turns on browser.send_pings.
Overview
The HTML ping attribute holds a list of URLs to notify when someone follows a hyperlink. The feature is called hyperlink auditing, and it works on <a> and <area> elements with an href.
Under the HTML standard, the browser splits the value on spaces, tabs and line breaks, skips every URL whose scheme isn't http or https, and sends a request to each one left. These requests can run in parallel with the navigation, independent of its result.
Each request uses the POST method, the header Content-Type: text/ping and the four-byte body PING. The standard has it carry credentials such as cookies, but no Referer header.
Nothing is sent until someone activates the link, so a click handler that calls preventDefault() cancels the ping along with the navigation. Browsers may also skip pings to honor a user's settings, such as ignoring every third-party ping URL.
Syntax
<a href="https://example.com/files/report-2026.pdf"
ping="https://example.com/stats/download">2026 report (PDF)</a>
Values
| Value |
|---|
| A space-separated list of URLs. |
Example
<p>
<a href="https://example.org/setup-guide/"
ping="https://example.com/stats/outbound">Read the setup guide</a>
</p>
<p>
<a href="https://example.com/files/report-2026.pdf"
ping="https://example.com/stats/download
https://example.org/collect">Download the 2026 report</a>
</p>
<img src="plans.png" usemap="#plans" alt="Basic and Pro plans" width="240" height="60">
<map name="plans">
<area shape="rect" coords="0,0,120,60" href="https://example.com/plans/basic"
ping="https://example.com/stats/plan" alt="Basic plan">
<area shape="rect" coords="120,0,240,60" href="https://example.com/plans/pro"
ping="https://example.com/stats/plan" alt="Pro plan">
</map>
Best practices
- Read the
Ping-Toheader on the server that receives thepingrequest. The request body says nothing about the link, so the target arrives only in that header, unless you add details to the ping URL's query string. - Separate ping URLs with spaces, never commas. A comma becomes part of the URL, so
ping="a, b"sends its first request to an address ending in a comma. - Spell out each ping URL in full, starting with
https://orhttp://. A relative one such as/statsresolves against the page but fails validator.nu's check for HTTP(S) URLs. - Answer pings with an empty response. The browser throws away any body the server sends back and may close the connection once one starts to arrive.























