aadsm / jsmediatags

Media Tags Reader (ID3, MP4, FLAC)
Other
745 stars 128 forks source link

XMLHttpRequest blocked by CORS #102

Closed leptr closed 5 years ago

leptr commented 5 years ago

Hi, I'm trying to make a music player which displays all data automatically and I've found this library. I'm using it in pure javascript with the sample code for a file on remote server. This is my code `var jsmediatags = window.jsmediatags;

jsmediatags.read("", {

onSuccess: function(tag) {

  console.log(tag);

},

onError: function(error) {

  console.log(error);

}

});` However, when I run the code, I get the following error Access to XMLHttpRequest at '' from origin 'http://127.0.0.1:5500' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

I'd appreciate any helpful information. Thanks

aadsm commented 5 years ago

That means the remote server you’re using needs to send the Access-Control-Allow-Origin http header. If you own that server you need to add that. If you don’t you need to ask who does to add them.