On this page
The HTML anchor ping attribute is intended to notify one or more URLs when a user follows a link. That notification is separate from the navigation to the link’s destination. For privacy-conscious developers, the important question is not just whether a browser recognizes the attribute, but whether a request actually leaves the browser under the conditions being tested.
This article explains the distinction and provides a local test that does not involve real visitors. Verification limitation: The test was not run for this article, and the WHATWG HTML Living Standard and current browser documentation could not be consulted in this environment. Verify the specification, browser documentation, and results in each browser you intend to cover before publishing a support claim.
Key Takeaways
- The HTML anchor
pingattribute identifies URLs intended to receive link-activation notifications; it is not the link’s destination. - A ping request is distinct from a
Refererheader, which may accompany a navigation or another request depending on browser policy. - Browser behavior, user settings, extensions, and network controls can affect whether a ping is sent. Do not describe support as universal.
- Test on a page and server you control, and inspect both developer tools and server logs.
What the HTML anchor ping attribute does
Consider this illustrative link:
<a href="/destination" ping="/audit">Open destination</a>
The href identifies where the user navigates. The ping attribute identifies an endpoint intended to receive a separate notification when the link is followed. The attribute can list more than one notification URL, separated by spaces.
A ping is intended as a background POST request rather than the navigation that loads the destination. Its purpose is to report link activation; the user does not navigate to the ping endpoint. Whether a particular browser sends it in a particular situation needs to be checked, not assumed.
A Referer header serves a different purpose: it can tell a receiving server about the page associated with a request. It may be limited or omitted by referrer policy and browser behavior. A separate ping endpoint can receive a request even though it is not the destination page, so checking only the destination’s referrer logs is not a complete test of link tracking.
Advertisement
Run a local privacy test
This lab uses Python’s standard library and binds only to your own computer’s loopback address. It logs requests to a local endpoint; it does not require a public website or real visitors. The code has not been executed for this article, so the steps describe what to look for rather than observed results.
Save the following as ping_lab.py:
from http.server import BaseHTTPRequestHandler, HTTPServer
PAGE = b'''<!doctype html>
<html lang="en">
<head><meta charset="utf-8"><title>Ping lab</title></head>
<body>
<a href="/destination" ping="/audit">Open destination</a>
</body>
</html>'''
DESTINATION = b'''<!doctype html>
<html lang="en">
<head><meta charset="utf-8"><title>Destination</title></head>
<body><p>Destination page</p></body>
</html>'''
class Handler(BaseHTTPRequestHandler):
def log_message(self, format, *args):
# Avoid the default request log; this lab prints audit requests below.
pass
def do_GET(self):
if self.path == "/":
body = PAGE
elif self.path == "/destination":
body = DESTINATION
else:
self.send_error(404)
return
self.send_response(200)
self.send_header("Content-Type", "text/html; charset=utf-8")
self.send_header("Content-Length", str(len(body)))
self.end_headers()
self.wfile.write(body)
def do_POST(self):
if self.path != "/audit":
self.send_error(404)
return
try:
length = int(self.headers.get("Content-Length", "0"))
except ValueError:
self.send_error(400)
return
if length < 0 or length > 65536:
self.send_error(413)
return
body = self.rfile.read(length)
print("Audit request:", self.command, self.path, flush=True)
for name in ("Content-Type", "Referer", "Ping-From", "Ping-To"):
print(f" {name}: {self.headers.get(name)}", flush=True)
print(f" Body: {body!r}", flush=True)
self.send_response(204)
self.end_headers()
server = HTTPServer(("127.0.0.1", 8000), Handler)
try:
server.serve_forever()
except KeyboardInterrupt:
pass
finally:
server.server_close()
In a terminal, run:
python3 ping_lab.py
If port 8000 is unavailable, change the port in the script and use the same port in the browser address. Then:
- Open
http://127.0.0.1:8000/in the browser you want to examine. - Open developer tools and select the Network panel. Enable the option to preserve requests across navigation, if available, and clear the existing entries.
- Click Open destination normally. Inspect the navigation to
/destinationand look separately for a POST to/audit. Check the terminal for an audit record too. - If an audit request appears, inspect its method, headers, and body. A ping request may contain metadata about the source and destination; the exact headers visible can depend on the browser and context.
- Stop the server with Ctrl+C when finished.
A request shown in developer tools is useful evidence of browser activity; the local server log independently indicates whether this server received it. If you see no audit record, check the Network panel, filtering, extensions, browser settings, and whether the server was running before concluding that the browser does not support ping. A blocked attempt and a received request are different outcomes.
This is a same-origin, local HTTP test. It does not establish how the browser handles cross-origin ping endpoints, redirects, other schemes, or every privacy configuration.
Advertisement
Compare browsers and privacy settings
Repeat the lab in each browser and configuration relevant to your audience. Record the browser name and version, operating system, relevant privacy settings and extensions, the action used to activate the link, and whether developer tools and the server each showed a request. Check current browser documentation and the WHATWG standard alongside your measurements before publishing a compatibility statement.
For a meaningful comparison, change one condition at a time—for example, compare a normal profile with the same browser’s private browsing mode, or repeat with a privacy extension enabled. Do not assume private browsing, a particular setting, or an extension blocks ping without measuring it. If a browser offers a relevant control, document the exact control and version you actually checked; controls and defaults can change.
A local result is evidence about that setup, not a guarantee for all users. Browser updates, enterprise policies, content blockers, network filtering, and the context in which a link is activated can change the outcome.
Privacy implications and disclosure
A ping endpoint can learn that a link was activated and may receive information about the originating page or destination, depending on browser behavior and policy. If the endpoint is operated by a third party, that party may be able to associate the request with other information it receives, such as network metadata or applicable identifiers. Avoid putting personal information or secrets in URLs, including query strings.
Website owners should assess whether this collection is necessary, disclose link tracking in a way that is accurate for their implementation and audience, and review applicable consent and privacy obligations. A disclosure is not a substitute for minimizing collection or meeting legal requirements. Test with fictional or local data rather than instrumenting real visitors for an experiment.
Common Mistakes
- Treating
pingas a referrer setting. It identifies separate notification endpoints; referrer policy governs information sent in referrer-related contexts and should not be assumed to disable ping requests. - Looking only for the destination navigation. Inspect the audit endpoint separately and preserve the Network log across navigation.
- Equating an attempted request with server receipt. Compare browser observations with the endpoint’s logs.
- Declaring universal support or blocking. Record actual versions and settings, and verify documentation for each browser covered.
- Testing against a third-party endpoint or real users. Use a local or otherwise explicitly authorized environment.
Best Practices
Use link-activation tracking only when there is a clear need, keep the data collected to a minimum, and document the endpoint and retention practices. For an audit, test the actual deployed page as well as a controlled reproduction: scripts, policies, extensions, and browser settings can affect the result. Do not rely on a browser-side observation alone to prove what a remote service received or retained.
Conclusion
An anchor’s ping attribute is intended to trigger a separate notification request when a link is followed, but whether that happens is a browser- and configuration-dependent observation. Use a controlled endpoint and record both browser and server evidence before making a support or privacy claim.
What would your domain sell for?
A free TidyURLs account unlocks the Domain Estimator. It prices a name from 191,011 real domain sales.