I have a big json file (+-10mb). I want to load in this json file (myjson.json) in a Javascript function located in a HTML webpage. I found a lot of answers on google that s
Unfortunately, both XHR and the Fetch API are inextricably tied to HTTP, and cannot be used to load a resource from a relative path unless an HTTP server is involved. If you're loading your page via a file:
URL, you won't be able to use XHR or Fetch to get that data.
There are only two methods available to you:
Switch to JavaScript instead of regular JSON and use a tag (as previously suggested to you in another answer)
Allow the user to drag/drop the JSON file (or use ) to get a File reference that you can then load.