Weather widget running in Firefox but not in Chrome or codepen


I finished the weather widget project, the issue, it is working only in Firefox but not on Chrome or codepen.

Change your http to https on your API call.

1 Like

thank you. it did the trick

but now the switch between F and C isn’t working even though it is locally ?

Same problem, different function. Check your code and you will see another http which should be https. Also, there is no need to call the API twice as you are doing. Once you have the temperature data from the page load, you can save the Celsius and Fahrenheit values to variables to use to display the correct temps when clicking on the F and C buttons.

You are right again, I thought i changed it before, but i realized i changed the url of the weather icon .

The API only sends the temp either in metric C or in Kelvin or in imperial F, I can store the Temperature values and use a function to convert from C to F, that is a way of doing it if i don’t call the API again to grab the other unit.

What do you think about it ?

I believe that is a much better way of handling the data.

There is math equation to convert C to F and C to F

The FCC challange -->

The in-depth explanation -->

I forgot about it. Thank you :slight_smile:

function convertToF(celsius) {
  var fahrenheit;
  // Only change code below this line
  fahrenheit = celsius * 9/5 + 32;
  // Only change code above this line
  return fahrenheit;
1 Like