I reckon this might be an old topic but I begin with Javascript... I get this error in my Javascript base code : "Fetch API cannot load file:///C:/Users[...]data.json. URL scheme must be "http" or "https" for CORS request"
All the answers I see online says that a local server is needed to use fetch with a file. But I would need to find solutions without using a local server.
Here is my code :
function getData() {
fetch('data.json')
.then(res => res.json())
.then(data => {
console.log(data)
})
};
getData();
My files HTML et JS are well linked and my file data.json is located in the same folder.
Somebody (who has understood my problem :) could give me some help/advice please? Thanks