Created
July 4, 2018 09:27
-
-
Save luxplanjay/68adb45d65ed239f86e496d16ddfa3c7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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