So recently I completed the Local Weather App and I had to struggle to get it to work in the local environment. I usually upload it to Codepen once I complete the project. But now it refuses to use the HTTP request (IP-API). Does anyone know any resources that allows it to work both in the local environment AND via Codepen?
Should I just upload it anyway even though some local resources aren’t available? Or should I go back and try to make it work correctly on Codepen?
If you try to console.log the answer from the api server what do you get?
I had an error from Codepen -> Mixed Content. Basically, trying to use a GET request via the “insecure” HTTP through Codepen’s HTTPS is throwing an error for me. I’m looking for a workaround and I think I’m just going to utilize a different geolocation tactic. I’ll let you know how it goes.
@uria, thank you.
That seemed to do the trick. I used a geolocation API that was HTTPS instead of insecure. After two weeks, off and on, I have finally completed it.
Hello, I’m trying to see the project but I have this error:
Failed to load resource: the server responded with a status of 400 (Bad Request)…
Hmm… I don’t seem to see that error when looking at my project. I’ll double check though, that’s really peculiar.
Have you tried with https://cors-anywhere.herokuapp.com/ with prefix in API request. I think it will solve the problem. Let me know if it works
Yes, I used that initially when working in the local environment. I think they have some jQuery code that I implemented. I just wish the cross-origin headers did what I wanted. Thank you again.
@asg5704 I can see the project, it looks really good btw , but for some reason it os showing me 32F although here it is more like 95F… and also the switch button isn’ t working.
I have tried to log the data from the geoip api but seens like nothing comes back…
Try using the browser api window.navigator.geolocation
If you need more help I’ll be later on with my computer then would be easier for me to help.
Hi looks nice but unfortunately I have exactly same issue as @uria