References

Beginner-friendly references for web development, with live, editable examples.

The HTML ping attribute

Attribute All modern browsers Updated
Quick answer

The HTML ping attribute lists URLs to be notified with a POST request when the link is followed (used for tracking). It is used on the <a> and <area> elements.

Overview

The ping attribute pings URLs when the link is clicked. It is used on the <a> and <link> elements.

It relates to hyperlinks and linked resources — the destination, where it opens, the relationship to the current page, and security or privacy hints for the request.

Values

Value
A space-separated list of URLs.

Best practices

  • Write descriptive link text — avoid "click here", which is meaningless out of context.
  • When using target="_blank", modern browsers add rel="noopener" for you, but set it explicitly for older ones.
  • Use rel values like nofollow, noreferrer and canonical deliberately for SEO and privacy.
  • Make sure links are distinguishable by more than color alone.

Frequently asked questions

What does the ping attribute do?
Pings URLs when the link is clicked.
How do I open a link in a new tab?
Add target="_blank". Pair it with rel="noopener" for security in older browsers.
What does the rel attribute do on a link?
It states the relationship to the linked resource — for example nofollow, noreferrer, stylesheet or canonical.
Which elements use the ping attribute?
It is an element-specific attribute, used on the <a> and <link> elements.