Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
If you find these projects useful please consider becoming a sponsor with Patreon, GitHub or Liberapay.

Geolocation

Post Reply
dilfich
Posts: 368
Joined: Thu Nov 30, 2017 1:17 am

Geolocation

Post by dilfich »

Hi, geolocation is almost working now and the question is, how do I get through the pop-up window where permission is asked?

There is also a problem with this resolution in the OSR browser, sometimes there is a window and sometimes there is not.
User avatar
salvadordf
Posts: 4564
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Geolocation

Post by salvadordf »

dilfich wrote: Tue Feb 04, 2025 12:37 pm Hi, geolocation is almost working now and the question is, how do I get through the pop-up window where permission is asked?
Try using the TChromiumCore.OnRequestMediaAccessPermission event.
dilfich wrote: Tue Feb 04, 2025 12:37 pm There is also a problem with this resolution in the OSR browser, sometimes there is a window and sometimes there is not.
Please, provide a step by step guide to reproduce that issue.
dilfich
Posts: 368
Joined: Thu Nov 30, 2017 1:17 am

Re: Geolocation

Post by dilfich »

salvadordf wrote: Tue Feb 04, 2025 2:44 pm Try using the TChromiumCore.OnRequestMediaAccessPermission event.
Almost but a little different :) Everything is working now!

Code: Select all

 OnShowPermissionPrompt
 aResult := True;
 callback.cont(CEF_PERMISSION_RESULT_ACCEPT);
salvadordf wrote: Tue Feb 04, 2025 2:44 pm Please, provide a step by step guide to reproduce that issue.
https://postimg.cc/VdVktcvW
There are no steps, we run the demo SimpleOSRBrowser and the request does not always appear.
dilfich
Posts: 368
Joined: Thu Nov 30, 2017 1:17 am

Re: Geolocation

Post by dilfich »

There is another question, what is the difference?

CEF_PERMISSION_RESULT_DENY
and
CEF_PERMISSION_RESULT_DISMISS

If I forbid it, what should I specify?
dilfich
Posts: 368
Joined: Thu Nov 30, 2017 1:17 am

Re: Geolocation

Post by dilfich »

By the way, it also works on older versions!
Tested for 126.
Plus emulation :)
https://postimg.cc/Fk1BqsdP

Code: Select all

   TempParams := TCefDictionaryValueRef.New;
   TempParams.SetDouble('latitude', 40.730610);
   TempParams.SetDouble('longitude', -73.935242);
   TempParams.SetDouble('accuracy', 11);
   Chromium1.ExecuteDevToolsMethod(0, 'Page.setGeolocationOverride', TempParams);
User avatar
salvadordf
Posts: 4564
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Geolocation

Post by salvadordf »

About the meaning of CEF_PERMISSION_RESULT_DENY and CEF_PERMISSION_RESULT_DISMISS I can only repeat what you see in the code comments, which is the official CEF documentation. :?

I haven't tested that feature intensively but perhaps the value to the permission request is cached for the duration of the session.
Post Reply