Error to get data from url json


#1

Hi


I am having a problem to get the jason data from an url. I got this error from chrome dev tool. It seems that everything has to be processed via https and no http. There is a way to bypass it!

Thanks
Banjer71


#2

The https:// protocol can’t load http:// URIs AFAIK: :disappointed:




#3

This means that is there no way to fix this? Is it a http://api.open-notify.org issue? Being a total beginner with this kind of things, there is a way to use some api that really works with some of the eamples Daniel Shiffman shows in his tutorials.
I tried to replace that api with another ones Shiffman use in another tutorial and it is https but this time I get another kind of error : “Access-Control-Allow-Origin” . I am going crazy…


#4

If you had checked my own Open-Notify sketch in my 1st reply:

You’d see it works as long the “.html” file is running under the http:// protocol.

If your only option is to use the https:// protocol, maybe you can find some proxy service which would access http://api.Open-Notify.org/astros.json and forward it back to your sketch.


#5

A site needs to explicitly allow access to its resources, so we can load them. That’s called CORS:

If a site doesn’t enable CORS, we’re gonna need some proxy service in order to bypass it! :upside_down_face:


#6

Wow let me say thank you first of all for your reply!!!
I checked your post but as I said before I am a beginner and actually I did not understand that it was a solution :slight_smile: I am going to find out how to use it in my file. and thank you also for the mdn link!!