Geolocation from local html-file stopped working in evening and morning

Geolocation from local html-file stopped working in evening and morning
0.0 0

#1

Hi,

Yesterday my weather-page, loaded as a file (file:///FreeCodeCamp/weather-today/weather.html), worked fine.
But this morning I get the error back from my js-script: Location not available.

I tried the page from w3schools and that also returns “location not available”.

I tried both Firefox and Chrome but both fail today.

Is it possible that this service is down? Is it possible to see a notification of the service-supplier if a service is down?


#2

Can you post all of your code (or at least html and JavaScript), so we can examine your code and attempt to debug it?


#3

Oke, I will create a new codepen. Takes a few minutes.


#4

You can just post the code in a forum reply if you want.


#5

I had to create the codepen anyway :).

Here is the codepen weather

There is no CSS (work in progress).


#6

Your code works for my location. I ran your code on Codepen and on my local pc and both worked with Chrome. What browser are you using when you get this message? What browser were you using when it worked?

Are you getting the “location not available” shown in the console?


#7

My console shows:

func initPage|                                       weather.js:6:5
func retrieveWeatherForecast|                        weather.js:13:5
func geoError|               (!!!)                   weather.js:27:5

The HTML-page says:
Location information is unavailable.

When displaying on “codepen” I get the same message.

I was using both browsers yesterday and this morning:
Firefox: Quantum 58.0.2 on Linux
Chrome: 64.0.3282.140 (Official Build) Built on Ubuntu , running on Ubuntu 17.10 (64-bit)


#8

But if it is working on your location …
I will reset my modem to see if that helps.

EDIT:
Nope, did not help

I searched google on same issue but cannot find related articles.


#9

I have found a solution:
In about:config (Firefox) I changed the value of GEO.WIFI.URI
from https://www.googleapis.com/geolocation/v1/geolocate?key=%GOOGLE_API_KEY%
to https://location.services.mozilla.com/v1/geolocate?key=%MOZILLA_API_KEY%

Now it works again. I have no clue however what has happened. Why is the google-uri suddenly malfunctioning?

Can somebody reply on this and show me which URI he/she uses? I am curious if this is the real problem.


#10

I just ran an update on the Ubuntu Linux software and now things are working again with the original URI.
Next time I must remember to do that first.


#11

It sounds crazy but the geolocation-object (home laptop) is the past 3 days only functioning roughly between 12:00 pm and 19:00 pm.

I noticed that in the evening and morning the “permission dialog box” comes very fast back with the message “unknown error” (position.message). I think the browser did not even bother to make the request to google’s API.