I want to prefetch (or maybe preload) a JSON file from an URL and use it later on my JS file.
How can I send the file prefetched JSON to the JS file?
Something like:
(on the HTML head)
<link rel="prefetch" href="https://json.file" as="fetch">
(on the JS file)
fetch("the prefetch file above")
.then((res) => res.json())
.then((data) => {
});
New contributor
saposabio is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.