Page 1 of 1

Modify some parameters of Navigator before creating TChromium

Posted: Sat Apr 18, 2020 5:07 am
by zer0x1byte
Hello,

First of all thank you so much for cef4delphi!

I have three questions.
1. I would like to be able to inject js some of Navigator's parameters before creating TChromium, or is there any other way to modify them directly?
oscpu
hardwareConcurrency
deviceMemory
VRDisplay
Window.outerHeight
Window.outerWidth
window.screen.height
window.screen.width
timezone

2. I know the current version of Cef4delphi removes geolocation, how do I apply it to Cef4Delphi if I call the Google API?

3. I don't want to block the Canvas Fingerprint fingerprint, I want to replace this fingerprint myself, is there any way to replace it?

thx all!

Re: Modify some parameters of Navigator before creating TChromium

Posted: Sat Apr 18, 2020 8:58 am
by salvadordf
zer0x1byte wrote: Sat Apr 18, 2020 5:07 am 1. I would like to be able to inject js some of Navigator's parameters before creating TChromium, or is there any other way to modify them directly?
oscpu
hardwareConcurrency
deviceMemory
VRDisplay
Window.outerHeight
Window.outerWidth
window.screen.height
window.screen.width
timezone
Some screen size parameters can be customized if you use the OSR mode but I don't know how to modify the rest using any CEF wrapper.
zer0x1byte wrote: Sat Apr 18, 2020 5:07 am 2. I know the current version of Cef4delphi removes geolocation, how do I apply it to Cef4Delphi if I call the Google API?
You should be able to use any Google REST API if you authenticate the user with OAuth2 first. Use the OAuth2Tester demo and read the code comments.
zer0x1byte wrote: Sat Apr 18, 2020 5:07 am 3. I don't want to block the Canvas Fingerprint fingerprint, I want to replace this fingerprint myself, is there any way to replace it?
The only way I know to do that is to modify Chromium's code and build a custom version of the CEF binaries.

Re: Modify some parameters of Navigator before creating TChromium

Posted: Sun Apr 19, 2020 12:55 am
by zer0x1byte
ok,thx for your help!

Re: Modify some parameters of Navigator before creating TChromium

Posted: Sun Apr 19, 2020 1:25 am
by zer0x1byte
I want to try to inject js code before creating the browser,Which event should i use? thx again.

Re: Modify some parameters of Navigator before creating TChromium

Posted: Mon Apr 20, 2020 8:21 am
by salvadordf
JavaScript extensions should be created in GlobalCEFApp.OnWebKitInitialized and "window bindings" should be added in GlobalCEFApp.OnContextCreated

Read this for more information about the JavaScript integration in CEF and checkout the CEF4Delphi demos inside the "Delphi_VCL\JavaScript" directory :
https://bitbucket.org/chromiumembedded/ ... gration.md