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! While you're at it, check out some resources Treehouse students have shared here.

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

JavaScript Asynchronous Programming with JavaScript Asynchronous JavaScript with Callbacks Implement a Callback

Brian Crowe
seal-mask
.a{fill-rule:evenodd;}techdegree
Brian Crowe
Full Stack JavaScript Techdegree Student 7,521 Points

Out of Date API Request

We need a workaround for this. While I understand this lesson is older, I'm consistently getting the following error:

callbacks.js:16 Mixed Content: The page at 'https://port-80-sxkqtvonhh.ecs-production.treehouse-app.net/' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://api.open-notify.org/astros.json'. This request has been blocked; the content must be served over HTTPS.

Modern browsers don't let you override this, so it doesn't matter if I'm using a Workspace or running from an IDE. For now, I'm mocking in the data gleaned from open-notify.org. Please update or include this option somewhere.

2 Answers

Steven Parker
Steven Parker
242,190 Points

I'm running the most current Chrome, and there are several ways to override this behavior.. One is to enable the flag "Insecure origins treated as secure" and add the site to the exception list it uses.

Another is to set "insecure content" to "allow" in the site settings for "privacy and security".

Or the one I use myself is to add the site(s) to the "allowed" list in this setting:
ā€ƒ Settings :point_right: Privacy and security :point_right: site settings :point_right: Additional content settings :point_right: Insecure content.

I'd be surprised if Chrome is the only browser that has such controls, so if you're using something else you might want to give the documentation for it a closer look.

Laura Coronel
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Laura Coronel
Treehouse Teacher

Hi Brian Crowe, You can try what Steven Parker suggested. If that doesn't work also check out the teacher's notes on Async Programming and Callback Function. Be sure to check the teacher's notes on all videos. If anything changes or doesn't match what the teacher shows we usually let you know in the teacher's notes.

Also I tried this code in my IDE and didn't get the error like you indicated. I would double check your code.