Limited supportUse with care and provide a fallback when broad support matters.

Overview

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. It is most useful when native HTML semantics or browser capabilities can replace custom implementation work.

Browser support

Feature Desktop Mobile
Chrome
Edge
Firefox
Safari
Chrome Android
Safari iOS
12
17
1
5.1
18
5
HTML attribute
ping
12
17
1
6
18
6
ping
12
17
1
6
18
6
DOM API

The ping property of the HTMLAreaElement interface is a space-separated list of URLs. When the link is followed, the browser will send POST requests with the body PING to the URLs.

12
17
1
5.1
18
5

The ping property of the SVGAElement interface returns a string that reflects the ping attribute, containing a space-separated list of URLs to which, when the hyperlink is followed, POST requests with the body PING will be sent by the browser (in the background). Typically used for tracking.

144
144
61
144
Other
svg.elements.a.ping
Experimental
61
1+Supported (version) Not supported Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)
Notes 2 item(s)
Limitation
  • This browser only partially implements this feature
Implementation note
  • This property is exposed but has no effect if the `browser.send_pings` preference is not set to `true`. See bug 951104.
Notes 2 item(s)
Limitation
  • This browser only partially implements this feature
Implementation note
  • This property is exposed but has no effect if the `browser.send_pings` preference is not set to `true`. See bug 951104.
Notes 2 item(s)
Limitation
  • This browser only partially implements this feature
Implementation note
  • This property is exposed but has no effect if the `browser.send_pings` preference is not set to `true`. See bug 951104.
Notes 2 item(s)
Limitation
  • This browser only partially implements this feature
Implementation note
  • This property is exposed but has no effect if the `browser.send_pings` preference is not set to `true`. See bug 951104.
Notes 2 item(s)
Limitation
  • This browser only partially implements this feature
Implementation note
  • This property is exposed but has no effect if the `browser.send_pings` preference is not set to `true`. See bug 951104.
Notes 2 item(s)
Limitation
  • This browser only partially implements this feature
Implementation note
  • This property is exposed but has no effect if the `browser.send_pings` preference is not set to `true`. See bug 951104.

Syntax

HTML
<a href="https://example.com"
  ping="/tracking/click?id=123">
  Link with tracking
</a>

Use cases

  • Use ping

    Use ping when standard HTML needs a more specific platform feature, semantic signal, or browser capability.

  • Handle edge cases

    Apply ping to solve a focused requirement without redesigning the whole page architecture.

Cautions

  • Test ping in your target browsers and input environments before depending on it as a primary behavior.
  • Provide a fallback path or acceptable degradation strategy when support is still limited.

Accessibility

  • Make sure ping supports the intended task without making the page harder to perceive, understand, or operate.

Powered by web-features