The JavaScript on my website loads several JSON to initialize itself.
I would like to preload them so, when the JavaScript will launch an Ajax request on it, they wi
According to https://developer.mozilla.org/en-US/docs/Web/HTML/Preloading_content , you have to add as="fetch"
for JSON files.
So your code becomes
It's supported by all modern browsers and you get a warning message if this resource is not used within a few seconds because it is counterproductive to "preload" it in a such case (delay, double load etc.)
It's different from which is to anticipate future navigation and not supported widely.
A Chrome illustrated article about this: https://medium.com/reloading/preload-prefetch-and-priorities-in-chrome-776165961bbf