CSS Portal

HTML ping Attribute

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
ping
HTML AttributeThis attribute is supported by all modern browsers.
Updated 29th March 2024

Description

The HTML ping attribute is used to send a short notification to a URL when the user clicks on a hyperlink. This attribute can be included within <a>, <area>, or <form> elements, and its primary purpose is to provide webmasters with a simple way to track clicks or to log user visits to external links without interrupting the user's browsing experience.

When a user clicks on an element that has a ping attribute, the browser sends a POST request to the specified URL(s) in the background. Multiple URLs can be specified by separating them with a space. This process is transparent to the user, allowing for the collection of analytics data or other information without affecting the user's interaction with the website. It's worth noting that the ping attribute does not alter the behavior of the hyperlink itself; the browser will still navigate to the link's href attribute as usual.

However, due to privacy concerns and potential misuse, the support and behavior of the ping attribute may vary across different browsers and user settings. Some browsers may offer users the option to disable this feature, or it may not be supported at all. Therefore, web developers should consider these factors and not solely rely on the ping attribute for critical analytics or tracking purposes.

Syntax

<a href="URL" ping="list-of-URLs" />

Values

  • list-of-URLsA space-separated list of URLs.

Applies To

Example

&lt;a href="https://www.example.com" ping="https://analytics.example.com/track-link-click"&gt;Click here&lt;/a&gt;
Open in editor

Browser Support

The following information will show you the current browser support for the HTML ping attribute. Hover over a browser icon to see the version that first introduced support for this HTML attribute.

This attribute is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee