-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Data BMKG has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource #276
Comments
Sudah mencoba pakai format XML mas? error |
kalo pake xml aku belum coba mas, oalahh jadi butuh izin gitu yah ke bmkg nya berarti perlu API key yah mas? |
sama ternyata mas pake yang XML juga, aku coba masih block by CORS |
Mas @ujangaripin24 menconsume API-nya menggunakan apa mas? apakah dari sisi server atau web apps? // index.js
var axios = require('axios');
var config = {
method: 'get',
maxBodyLength: Infinity,
url: 'https://data.bmkg.go.id/DataMKG/TEWS/gempadirasakan.json',
headers: { }
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
}); atau bisa mencoba mengcalling dari pureJS var requestOptions = {
method: 'GET',
redirect: 'follow'
};
fetch("https://data.bmkg.go.id/DataMKG/TEWS/gempadirasakan.json", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error)); Error No-Cross origin seringkali terjadi jika permintaan data dilakukan melalui sisi webapps |
aku juga pake axios dan makasih mas ini sekarang berhasil |
Wah great to hear that mas @ujangaripin24, jika boleh mungkin bisa dielaborasi solvingnya seperti apa atau potongan kode sebelum dan sesudahnya seperti apa. Biar menjadi wawasan bagi teman" yang ada di sini |
izin Admin untuk menyampaikan masalah
has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource
saya menggunakan link dari BMKG ['https://data.bmkg.go.id/DataMKG/TEWS/gempadirasakan.json'] tersebut, tapi pas saya mau tampilkan di console.log() muncul error
'Access to XMLHttpRequest at 'https://data.bmkg.go.id/DataMKG/TEWS/gempadirasakan.json' from origin 'http://localhost:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.'
itu kenapa yah? mohon jawab Admin
The text was updated successfully, but these errors were encountered: