Skip to main content

HTML Guide

Bad value X for attribute “ping” on element “a”: Must contain only “http” or “https” URLs.

The W3C Validator issue you’re seeing is because the ping attribute on the <a> (anchor) element is supposed to contain a space-separated list of URLs to which, when the hyperlink is activated, the browser will send ping requests. The ping attribute must only contain proper “http” or “https” URLs, that is, relative URLs are not allowed.

Example of Incorrect Code

<a href="https://example.com" ping="/track">Visit Example</a>

Examples of Correct Code

  1. Proper Ping URL: Ensure the ping URL starts with http or https and is correctly formatted.

    <a href="https://example.com" ping="https://example.com/track">Visit Example</a>
  2. Multiple URLs: If you have multiple URLs, they should be space-separated and each should be a valid URL.

    <a href="https://example.com" ping="https://example.com/track https://example.com/another-track">Visit Example</a>

Common Mistakes to Avoid

  • Using invalid URL schemes like mailto: or /relative-path.
  • Including broken URLs or URLs with protocols other than http or https.
  • Incorrectly formatting multiple URLs; they must be space-separated, not comma-separated or otherwise.

Note

The ping property is not effective in Firefox and its usage may be limited due to privacy and security concerns.

Learn more:

Related W3C validator issues