Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@davidgilbertson
Created January 7, 2018 01:44
Show Gist options
  • Star 16 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save davidgilbertson/132497d7e0a9a815b150e35d44660893 to your computer and use it in GitHub Desktop.
Save davidgilbertson/132497d7e0a9a815b150e35d44660893 to your computer and use it in GitHub Desktop.
const linkEl = document.createElement('link');
linkEl.rel = 'prefetch';
linkEl.href = urlWithYourPreciousData;
document.head.appendChild(linkEl);
@david-fong
Copy link

Here's a link to a w3c issue that got raised a day after this hackernoon article was published. The issue is resolved in another one. In summary, there's a prefetch-src directive that defaults to default-src.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment