I have a large JSON blob I would like to have preloaded with my webpage. To do this, I have added
Thanks to the discussion in this bug, I got fetch
to work with preload
in Chromium 67:
First, add crossorigin attribute to the preload link:
Second, add same-origin credentials to the fetch request:
fetch(url, {credentials: 'same-origin'}).then(response => {
console.log(response);
});
Alternatively, you can use XMLHttpRequest
instead of fetch
(with XHR you don't need to add anything to the request), but only if you're not going to use responseType = 'blob'
- it won't work due to another bug.