Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Christos Tsamis8,091 Points
has been blocked by CORS policy
Code is right, debuged it and and faced a CORS policy problem.. Any ideas?
My suggestion would be that if you use Visual Studio Code to use the Live Server extension, that should fix your problems.
This is actually a really common frustration for developers and likely has nothing to do with your code: As a security feature, Chrome does not allow "cross-origin resource sharing" when you're working on localhost or just using File>Open to load a webpage locally. There are a few work-arounds, the best of which might be to run a local server with a domain alias -- but I understand that's asking a lot if you've never done it and just want to do this one thing. I personally would not suggest setting any flags
--disable-web-security that would compromise your browser. Here's some discussion about it: https://stackoverflow.com/questions/10883211/deadly-cors-when-http-localhost-is-the-origin.