javascriptdombrowser-feature-detection

Feature detection of <a ping> (Hyperlink Auditing)


The ping attribute of the a element is used for hyperlink auditing - basically when a link is followed each url listed in the attribute is 'pinged' with a HTTP POST.

According to Can I Use it's supported on all major modern browsers except Firefox (one day maybe).

How do I detect with JavaScript if the browser supports this functionality?


Solution

  • The following expression "ping" in HTMLAnchorElement.prototype will return true if the browser supports the ping attribute, false otherwise.