ping-rt-entries.html (1048B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8" /> 5 <title>Resource Timing Entry For hyperlink audit (ping)</title> 6 <link rel="help" href="https://w3c.github.io/resource-timing/"/> 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 <script src="/resource-timing/resources/observe-entry.js"></script> 10 </head> 11 <body> 12 <script> 13 promise_test(async t => { 14 const link = document.createElement('a'); 15 const delay = 500; 16 const ping = `/xhr/resources/delay.py?ms=${delay}`; 17 link.setAttribute('href', 'resources/close.html'); 18 link.setAttribute('target', '_blank'); 19 link.setAttribute('ping', ping); 20 link.innerText = 'Link'; 21 document.body.appendChild(link); 22 link.click(); 23 const entry = await observe_entry(ping); 24 assert_equals(entry.initiatorType, 'ping'); 25 assert_greater_than(entry.duration, delay); 26 }, "Hyperlink auditing (<a ping>) should have a resource timing entry"); 27 </script> 28 </body> 29 </html>