HTMLAnchorElement: ping 属性
HTMLAnchorElement 接口的 ping 属性是一个由空格分隔的 URL 列表。当链接被访问时,浏览器会向这些 URL 发送带有 PING 请求体的 POST 请求。
它反映了 <a> 元素的 ping 属性。
注意:此属性在 Firefox 中无效,并且由于隐私和安全原因,其使用可能受到限制。
示例
html
<a
id="exampleLink"
href="https://example.com"
ping="https://example-tracking.com https://example-analytics.com"
>Example Link</a
>
js
const anchorElement = document.getElementById("exampleLink");
console.log(anchorElement.ping); // Output: "https://example-tracking.com https://example-analytics.com"
规范
| 规范 |
|---|
| HTML # dom-a-ping |
浏览器兼容性
加载中…