1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23

content / test / data / sxg / prefetch-document.html [blame]

<title></title>
<body>
<script>
function addPrefetch(url) {
  let link = document.createElement('link');
  link.rel = 'prefetch';
  link.as = 'document';
  link.href = url;
  link.addEventListener('error', () => {
    document.title = 'FAIL';
  });
  document.body.appendChild(link);
}
const sxg_url = location.hash.substr(1);
addPrefetch(sxg_url);
new PerformanceObserver((list) => {
  for (const e of list.getEntries()) {
    if (e.name == sxg_url) {
      document.title = 'OK';
    }
  }
}).observe({ entryTypes: ['resource'] });
</script>