I'm a software engineer who likes to write articles, road or mountain bike, test gravity, and write code!
I write engineering or opinion articles to help educate others.
Location
Dallas, TX
Education
Software Engineering @ Western Governors University
I would use some caution with this. I develop using Firefox and I have never run into this problem just due to the browser. Usually this is a config item with the request or the API server. In this case my codepen rules out the API. Meaning this is a configuration issue with your code.
Even if the config item is only broken in Firefox you should fix it. Failure to do so will result in Firefox users not being able to use the resource you are building. Furthermore, leaving this issue will likely result in more bugs or instability in the future.
I'm a software engineer who likes to write articles, road or mountain bike, test gravity, and write code!
I write engineering or opinion articles to help educate others.
Location
Dallas, TX
Education
Software Engineering @ Western Governors University
But here is the GIST of it. CORS is a way that we protect our resources by limiting consumers of the resources to the same domain. Usually we see this error when you're writing a new API or connecting up to an API. Essentially, domain a hosting your site can't talk to domain b until the CORS policy is set correctly.
I'm a software engineer who likes to write articles, road or mountain bike, test gravity, and write code!
I write engineering or opinion articles to help educate others.
Location
Dallas, TX
Education
Software Engineering @ Western Governors University
I can see that you are using a publicly available API. I'm not sure what is wrong with your code. But, I created a simple codepen to give you an idea on how it is meant to be consumed.
thanks guys , i found that the problem is firefox is causing that problem cuz off security
I would use some caution with this. I develop using Firefox and I have never run into this problem just due to the browser. Usually this is a config item with the request or the API server. In this case my codepen rules out the API. Meaning this is a configuration issue with your code.
Even if the config item is only broken in Firefox you should fix it. Failure to do so will result in Firefox users not being able to use the resource you are building. Furthermore, leaving this issue will likely result in more bugs or instability in the future.
Try replacing
https://localhost:3000
withhttp://localhost:3000
(the 's' got removed) in your code.So this is a CORS error. Here is a link for more information. auth0.com/blog/cors-tutorial-a-gui...
But here is the GIST of it. CORS is a way that we protect our resources by limiting consumers of the resources to the same domain. Usually we see this error when you're writing a new API or connecting up to an API. Essentially, domain a hosting your site can't talk to domain b until the CORS policy is set correctly.
I can see that you are using a publicly available API. I'm not sure what is wrong with your code. But, I created a simple codepen to give you an idea on how it is meant to be consumed.
codepen.io/brentvdalling/pen/LYdKP...
yes with copen the code work but in localhost not
Hmm can you give us more info? Are you using node js?
What are you trying to do?
i am using react js
and what are you trying to do?
Are you connected to the internet?
yes of cours