Skip to content
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

CORS errors #10

Open
starakaj opened this issue May 15, 2017 · 1 comment
Open

CORS errors #10

starakaj opened this issue May 15, 2017 · 1 comment

Comments

@starakaj
Copy link

I'm having trouble using the API at all, due to CORS restrictions. All I tried to do was clone the repo, add my API key, and open the test.html page. But the result is just a bunch of errors like

XMLHttpRequest cannot load https://freesound.org/apiv2/search/text/?&page=1&filter=tag:tenuto%20durati…%2015.0]&sort=rating_desc&fields=id,name,url&query=violoncello&format=json. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.

I am however able to use the api if I build a request using Postman, for what it's worth.

@749
Copy link
Contributor

749 commented Jul 22, 2017

You are probably opening the file locally, Browsers block any AJAX to external pages when a page is opened locally, just upload it to a webspace and take it from there.
You may then still need to configure the CORS Headers, see w3 wiki

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants