coderef

pingLimited availability

The ping attribute for <a> elements sets a URL to send a POST request to when the <a> is clicked. This is typically used for outbound link reporting.

Not yet supported in all major browsers — check the table and provide a fallback.

Browser support

DesktopChrome
1–11Not supported
12+Supportedsince Jun 7, 2011
Current: 155
Edge
12–16Not supported
17+Supportedsince Apr 30, 2018
Current: 154
Firefox
✕Not supportedup to 157
Current: 157
Safari
1–5.1Not supported
6+Supportedsince Jul 25, 2012
Current: 27
MobileChrome Android
18+Supportedsince Jun 27, 2012
Current: 155
Firefox Android
✕Not supportedup to 157
Current: 157
Safari iOS
1–5Not supported
6+Supportedsince Sep 10, 2012
Current: 27

How to use

Not supported in Firefox, Firefox Android. Use feature detection below and provide a fallback (or a polyfill) for those browsers.

Example

Full syntax and examples are on MDN: ping.

Feature detection

JS · check before using
if ("HTMLAnchorElement" in globalThis && "ping" in HTMLAnchorElement.prototype) {
  // HTMLAnchorElement.ping is available
}

Sub-features

Support for each part of the feature (6). The overall table above shows when the whole feature works.

Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
HTMLAnchorElement.ping1217✕5.118✕5
HTMLAreaElement.ping1217✕5.118✕5
SVGAElement.ping144144✕✕144✕✕
a.ping1217✕618✕6
area.ping1217✕618✕6
a.ping✕✕✕✕✕✕✕