How cross browser is the ping attribute of anchor elements?

HtmlCross Browser

Html Problem Overview


<a ping="..."> is a relatively new, relatively unknown attribute in HTML5's anchor element.

How cross-browser compliant is it?

I've looked at online sources like MDN and http://caniuse.com, but found nothing that suggest browser support.

I want to know if it's a viable option for link tracking today in 2014.

Html Solutions


Solution 1 - Html

The ping attribute was included in pre-W3C drafts of HTML5. It remained in W3C drafts of HTML5 up until early 2010 - the last draft to include it was W3C Working Draft 4 March 2010; the next draft was W3C Working Draft 24 June 2010.

Why was it removed? It was massively unpopular - an HTML feature designed for advertisers to track clicks on adverts. Hixie's argument was that they can already do that; ping just made the process more transparent. And browsers would be able to offer a feature to block ping tracking. The counter-argument to that is that if browsers had this feature, publishers would avoid ping, it being unreliable compared to current click-tracking techniques.

Some browsers support it because of a combination of:

  • They implemented it early, and haven't felt a need to remove it; and
  • They support the WHATWG spec instead of or as well as the W3C spec.

Browsers that support it seem to be Safari and Chrome. (It's no surprise that the latter does; it originally used Safari's WebKit as its layout engine, and now uses Blink, a fork of WebKit.) Firefox also supports it, but since 2008, support has been disabled by default - it can be enabled through about:config, though I don't suppose many people do.

Internet Explorer does not support it (yet?). Opera 12.x does not support the attribute, but I haven't checked in Opera's next generation of Blink-based browsers.

Solution 2 - Html

You can also see the support with the Wikipedia article Comparison of layout engines (HTML5) for WebKit, Gecko, etc.

It appears to be a potential privacy invasive attribute as well, being able to send data to third parties. It is disabled by default in the browsers that support it.

Note: as null said, this post has not been updated since 2012!

Solution 3 - Html

According to deanhume.com only Safari and Google Chrome supports it and maybe Firefox also supports it because in their documentation they are not flagged with the warning "This API has not been standardized." So W3Schools may be right :)

Solution 4 - Html

Nowadays we have navigator.sendBeacon() which makes an http request that continues in the background after navigation if needed, and unlike ping, which is not enabled by default in firefox, this method is supported by all major browsers.

Also, fetch requests have 'keepalive' option, which allows them to continue after navigation.

Solution 5 - Html

It looks like Internet Explorer (no surprise) and Opera both seem to not like it.

Source: HTML <a> ping Attribute (W3Schools)

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMadara&#39;s GhostView Question on Stackoverflow
Solution 1 - HtmltobyinkView Answer on Stackoverflow
Solution 2 - HtmlSterling ArcherView Answer on Stackoverflow
Solution 3 - Htmla1204773View Answer on Stackoverflow
Solution 4 - HtmlKareem KamalView Answer on Stackoverflow
Solution 5 - HtmlSnappawapaView Answer on Stackoverflow