Answer the question
In order to leave comments, you need to log in
How to read json from gitlab repository bypassing CORS?
Hey!
The GitLab repository has a json file.
How to read it with JS bypassing CORS protection?
Tried like this, but gives CORS access error.
window.addEventListener('load', async () => {
const url = "https://gitlab.site.ru/test/-/raw/30527fe668d5b5f5be59fa7d6b6716/data_attempts.json";
try {
const response = await fetch(url, {method: 'GET'});
const json = await response.json();
console.log(json.values);
} catch (error) {
console.error('Ошибка:', error);
}
})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question