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.

Modify some parameters of Navigator before creating TChromium

Post Reply
zer0x1byte
Posts: 3
Joined: Fri Apr 17, 2020 2:39 pm

Modify some parameters of Navigator before creating TChromium

Post 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!
User avatar
salvadordf
Posts: 4575
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Modify some parameters of Navigator before creating TChromium

Post 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.
zer0x1byte
Posts: 3
Joined: Fri Apr 17, 2020 2:39 pm

Re: Modify some parameters of Navigator before creating TChromium

Post by zer0x1byte »

ok,thx for your help!
zer0x1byte
Posts: 3
Joined: Fri Apr 17, 2020 2:39 pm

Re: Modify some parameters of Navigator before creating TChromium

Post by zer0x1byte »

I want to try to inject js code before creating the browser,Which event should i use? thx again.
User avatar
salvadordf
Posts: 4575
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Modify some parameters of Navigator before creating TChromium

Post 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
Post Reply