Requests! please use HTTPS


#1

var xhr = new XMLHttpRequest();
xhr.open("GET", "https://www.codecademy.com/", false);
xhr.send();

console.log(xhr.status);
console.log(xhr.statusText);


#2

Tell us your problem so we can help you.


#3

i had to replace http with https in the request part , as per the instructions it should be http which doesnt work so i replaced it with HTTPS :slight_smile:


#4

I was literally going post exactly this. I was feverishly wondering why my code wasn't working, until i finally checked the console, and loe, the issue:

The request is being blocked because it is not being sent over secure http.

Mixed Content: The page at 'https://www.codecademy.com/assets/repl.html' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://www.codecademy.com/'. This request has been blocked; the content must be served over HTTPS.(anonymous function) @ (program):7
common-9d3c1c7….js:1 XHR finished loading: POST "https://www.codecademy.com/stats/v1/batch".flush @ common-9d3c1c7….js:1flushIfNecessary @ common-9d3c1c7….js:1_startIntervalFlush @ common-9d3c1c7….js:1


#5

cool...i had to go back to exercise one and compare the code and instructions to figure it out:) glad you didnt skip it.