-
Notifications
You must be signed in to change notification settings - Fork 478
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
Custom implementation of Geolocation #3881
Comments
Isn't that the purpose of Emulation.setGeolocationOverride? |
@amaitland Does this even work in CEF? Not sure if we are talking about the same thing, but in the Chromium-based browser it is true that it is possible to set a custom/mock/fake geolocation in the DevTools page. Still, I would like to do a clean c++/js implementation without extra stuff (DevTools protocol or whatever). |
Yes. If you use
You can programmatically send
|
This request is not a duplicate of https://www.magpcss.org/ceforum/viewtopic.php?f=6&t=19767
Dear Team,
I would like to handle the Geolocation request via the “
navigator.geolocation-getCurrentPosition()/watchPosition()
” functions by providing the answer myself, i.e., an arbitrary position that is therefore not necessarily based on the Google Geolocation.I am not sure of the correct implementation, but I succeeded by redefining in the Frame Context the two js functions
navigator.geolocation.getCurrentPosition
andnavigator.geolocation.watchPosition
"
CppGeolocationHandler
" will then provide somehow a minimum js object with latitude and longitude.So far so good. My only problem is that this method does not really fit with the Permission Request of the Geolocation (CefPermissionHandler::OnShowPermissionPrompt).
When I redefine those functions, the method OnShowPermissionPrompt is not triggered at all.
Testing it with the page "https://browserleaks.com/geo" I get my own value immediately in "getCurrentPosition" but the permission API shows that it is stuck in "prompt" - basically it (should be) waiting for the user to confirm the request (but as I already wrote, the corresponding method is not triggered)
On the other hand, if I do not (re)define the two functions, OnShowPermissionPrompt is triggered, but then I do not know how to provide my own location.
Any idea how to comply with OnShowPermissionPrompt and then provide an own answer if accepted would be very welcome.
Thanks in advance.
J.
The text was updated successfully, but these errors were encountered: