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

Ash Borkar
Ash Borkar
1,738 Points

Is the astrosUrl out of date? I get an error saying the request made to that API is an insecure request.

callbacks.js:16 Mixed Content: The page at 'https://port-80-n4u0tk2cso.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.

I changed the url from http to https but then I get a 'Connection Refused' error.

callbacks.js:16     GET https://api.open-notify.org/astros.json net::ERR_CONNECTION_REFUSED

2 Answers

Steven Parker
Steven Parker
229,744 Points

Someone had this same issue just a few days ago.

The request is insecure, but that's normal and correct for that service. The error is a result of your browser settings. Newer browsers, specifically those created after this course was released, generally don't allow mixed content (secured via https and insecure via http) by default. If you change your browser settings to allow insecure content (instead of blocking it), the requests will be accepted and processed.

Richard Morrison
Richard Morrison
6,156 Points

This is less than idea, though thank you for the helpful answer.

Dagim Alemu
Dagim Alemu
5,658 Points

Type about:config in the Firefox address bar and press Enter. Accept the warning and proceed. Search for security.mixed_content.block_active_content. Double-click on it to change its value to false.

This worked for me on firefox

I'm still getting this error even after allowing insecure content in Chrome. Any idea what may be causing this still?