New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: navigator.geolocation.getCurrentPosition() on windows 10 #36252
Comments
I'm not sure i understand but it seems that electron is not free as advertised. And i would have to pay per quantity of instructions executed? How much does it cost for each call to geolocation api? And is there a pricing table of all the payed features of electron? I guess a call to console.log() is free? But what about getUserMedia() for example? Is it a payed service? |
Someone from the Electron team can probably explain it better, but the data for If you really need to get an approximate location for a desktop users, there are other APIs as well you could use. But again, I don't see a point of using these APIs on a desktop without an actual GPS device. |
Yes, there is a point. If this api exists on javascript with desktop architecture, there is a reason. I am actually using it in a real project, which i would like to convert to an installable desktop app. I can see that electron is not able to do this since it's way too expensive for me. I will search another solution and i regret to have lost time studying electron. I wish there were a pricing table somewhere to look at before spending time on an electron project. Thanks for the answers. |
I think one of us is misunderstanding, I'm sure someone from the Electron team can clarify. This has nothing to do with Electron and these services are usually not free (or of low quality). Search for "ip geolocation", you'll find countless of databases and providers other than Google. Again, this is only a fallback if the location cannot be acquired through more accurate means such as GPS or Wifi. There's simply no other technical way to get a user's location if no other sources are available. And if it has to fall back to IP geolocation, the data is mostly useless anyway (depending on the use-case) and can be incredibly inaccurate. So you'd have to handle an error of |
This is so not true. You have one use case in mind and you make conclusions based on it. You don't think about the infinite possibilities of computer programs. I do have one app using this already, and i need this in my interface. Thanks for the explanations. |
You are both right, its frustrating (and I don't even think the GOOGLE_API_KEY hack works anymore anyway, didn't for me). I guess ipinfo.io api is the best way to go. |
Preflight Checklist
Electron Version
21.2.1
What operating system are you using?
Windows
Operating System Version
Windows 10 version 22H2
What arch are you using?
x64
Last Known Working Electron version
NA
Expected Behavior
I'm trying to make navigator.geolocation.getCurrentPosition() work. It works on any browser on the same machine, including chrome.
Actual Behavior
I get this error:
Network location provider at 'https://www.googleapis.com/' : Returned error code 403.
I don't need any google api. I'm using the standard javascript api to get geolocation position. I'm not querying google maps or anything.
Testcase Gist URL
https://gist.github.com/bonjourjoel/4b8953ac3fe9b61dcf8d085b052044fb
Additional Information
Running electron on windows 10 on the gist html file
bug-geo.html
will reproduce the issue:$> electron bug-geo.html
Precision 1: I do NOT use any google api, and i don't need any paid google api key. This code is standalone and not related to google in any way. This code should work and it's the example copied from the official mdn doc: https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/getCurrentPosition
Precision 2: This is not related to https. You can reproduce this on any page: Open any page with electron, including a secure page like https://google.com and open the dev tools, and copy/paste the script in the console. You will get the same error.
The text was updated successfully, but these errors were encountered: