I'm making 51 XMLHttpRequest calls to receive 161.3 MB of data for a mapping project. Every time I reload the page, these calls go out again, and it seems like they are all being cached, because the memory of the web browser (Firefox) continues to rise on every page reload until the tab crashes. I'm trying to prevent these results from being cached.
The original code returns the result fine:
var xhr = new XMLHttpRequest();
var url = 'http://briennakh.me/accessibility-maps/data/census tracts/geojsons/Alabama.json';
xhr.addEventListener('load', function() {
console.log(this.response);
});
xhr.open('GET', url);
xhr.responseType = 'json';
xhr.send();
When I add the request header xhr.setRequestHeader('cache-control', 'no-cache');
below xhr.open('GET', url);
to specify no caching, it throws the following error
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote
resource at http://briennakh.me/accessibility-maps/data/census%20tracts/geojsons
/Alabama.json. (Reason: CORS request did not succeed).
How can I stop these results from being cached?
Note: My site is served on Github pages. I do not have access to the backend code.