Skip to content

Instantly share code, notes, and snippets.

@luxplanjay
Created July 4, 2018 09:27
Show Gist options
  • Save luxplanjay/68adb45d65ed239f86e496d16ddfa3c7 to your computer and use it in GitHub Desktop.
Save luxplanjay/68adb45d65ed239f86e496d16ddfa3c7 to your computer and use it in GitHub Desktop.
// Can prefetch css and js
function prefetchResource(resourceUrl) {
const xhrRequest = new XMLHttpRequest();
xhrRequest.open('GET', resourceUrl, true);
xhrRequest.send();
}
// Can prefetch everything but support in not great, use for HTML
// <link rel="prefetch" href="path-to-content">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment