T
TommySuper
Member
- Beiträge
- 6
- Punkte Reaktionen
- 0
Hallo ich bekomme beim fetchen der WikidataAPi folgenden Fehler.:
Access to fetch at 'https://www.wikidata.org/w/api.php?...itles=Dresden&props=descriptions&languages=en' from origin 'http://localhost' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
was muss ich denn machen um das zu umgehen. Bzw. wie stelle ich meinen request auf no-cors?
vielen Dank
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
</html>
<script>
url = "https://www.wikidata.org/w/api.php?...itles=Dresden&props=descriptions&languages=en"
Promise.all([
fetch(url, {
}).then(response =>{
if(response.ok)
return response.json();
else
alert(response.status)
}),
]).then(res => {
output = res;
console.log(output)
})
</script>
Access to fetch at 'https://www.wikidata.org/w/api.php?...itles=Dresden&props=descriptions&languages=en' from origin 'http://localhost' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
was muss ich denn machen um das zu umgehen. Bzw. wie stelle ich meinen request auf no-cors?
vielen Dank
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
</html>
<script>
url = "https://www.wikidata.org/w/api.php?...itles=Dresden&props=descriptions&languages=en"
Promise.all([
fetch(url, {
}).then(response =>{
if(response.ok)
return response.json();
else
alert(response.status)
}),
]).then(res => {
output = res;
console.log(output)
})
</script>
Zuletzt bearbeitet: