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.

Update to CEF 83.4.2

User avatar
salvadordf
Posts: 4042
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Update to CEF 83.4.2

Post by salvadordf »

Hi,

CEF4Delphi is now updated to CEF 83.4.2.

This is what's new in the CEF binaries : CEF4Delphi had these changes recently :
  • Added the TChromium.DefaultWindowInfoExStyle property.
  • Added a context menu option to delete the cache at runtime to the CookieVisitor demo.
  • Fixed issue #248 : SimpleOSRBrowser shows a black screen in Windows 10 with Lazarus. Thanks pmccarenko! :)
  • Added FPC 3.2.0 support thanks to paweld! :)
  • Added a context menu option to set an input value and to visit the DOM using JavaScript in the DOMVisitor demo.
These are the CEF binaries :
User avatar
salvadordf
Posts: 4042
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Update to CEF 83.4.2

Post by salvadordf »

I just added a few more features :
  • Added TChromium.ClearCache procedure.
  • Added TChromium.Offline property.
  • Added a menu option to the MiniBrowser demo to clear the cache with the DevTools methods.
  • Added a menu option to the MiniBrowser demo to take a screenshot with the DevTools methods.
The new screenshot feature works even when the hardware acceleration is enabled. :D
dilfich
Posts: 330
Joined: Thu Nov 30, 2017 1:17 am

Re: Update to CEF 83.4.2

Post by dilfich »

I may be asking a lot, but it wouldn't hurt to return the browser's "ReCreate" function for re-creation without restarting the app. Or is it no longer possible?
User avatar
salvadordf
Posts: 4042
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Update to CEF 83.4.2

Post by salvadordf »

It's not possible to bring back the old TChromium.ReCreateBrowser procedure because it's necessary to follow the browser destruction steps to avoid crashes.

However, you can use the code in the demos that use frames to create and destroy browsers easily.
dilfich
Posts: 330
Joined: Thu Nov 30, 2017 1:17 am

Re: Update to CEF 83.4.2

Post by dilfich »

Code: Select all

var
  VL: ICefDictionaryValue;
begin
 VL := TCefDictionaryValueRef.New;
 VL.SetString(value, string);
 Chromium1.ExecuteDevToolsMethod(0, 'Network.param', VL);
Changing the UserAgent, everything works fine. But how do I return the default value?
User avatar
salvadordf
Posts: 4042
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Update to CEF 83.4.2

Post by salvadordf »

You can try "Browser.getVersion"
https://chromedevtools.github.io/devtoo ... getVersion

It should return the user agent string among other things.
User avatar
salvadordf
Posts: 4042
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Update to CEF 83.4.2

Post by salvadordf »

I just uploaded a small update to CEF4Delphi which includes a new procedure : TChromium.SetUserAgentOverride

The MiniBrowser demo uses that new procedure to change the user agent string at runtime using the new DevTools protocol methods.
dilfich
Posts: 330
Joined: Thu Nov 30, 2017 1:17 am

Re: Update to CEF 83.4.2

Post by dilfich »

It is not difficult to change it as it turned out but how to return it to the default? I will certainly update and look, but it is interesting now)
I haven't figured out how to use get and get the result yet(
Last edited by dilfich on Sun Jul 05, 2020 10:34 am, edited 1 time in total.
dilfich
Posts: 330
Joined: Thu Nov 30, 2017 1:17 am

Re: Update to CEF 83.4.2

Post by dilfich »

VL.SetString('timezoneId', 'Antarctica/Casey'); { https://mathiasbynens.be/demo/timezone }
Chromium1.ExecuteDevToolsMethod(0, 'Emulation.setTimezoneOverride', VL);
{ https://en.wikipedia.org/wiki/List_of_t ... time_zones }
It also works, you can make an option. It is also interesting how to change the system time.
User avatar
salvadordf
Posts: 4042
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Update to CEF 83.4.2

Post by salvadordf »

I updated CEF4Delphi again with a new procedure : TChromium.ClearDataForOrigin

It can be used to delete the storage data from a URL. The "aStorageTypes" parameters can have these values :
  • cdstAppCache
  • cdstCookies
  • cdstFileSystems
  • cdstIndexeddb
  • cdstLocalStorage
  • cdstShaderCache
  • cdstWebsql
  • cdstServiceWorkers
  • cdstCacheStorage
  • cdstAll : This is the default value and it deletes all storage data for that URL.
dilfich wrote: Sun Jul 05, 2020 10:31 am
VL.SetString('timezoneId', 'Antarctica/Casey'); { https://mathiasbynens.be/demo/timezone }
Chromium1.ExecuteDevToolsMethod(0, 'Emulation.setTimezoneOverride', VL);
{ https://en.wikipedia.org/wiki/List_of_t ... time_zones }
It also works, you can make an option. It is also interesting how to change the system time.
There are many new methods in the DevTools protocol that we can use now. It's tempting to add as many as possible but many of them are marked as "experimental" or "deprecated" which means that maintaining all DevTool methods in CEF4Delphi could be a little nightmare. :roll:

I'll try to add some of the most requested methods or at least give code examples showing how to use them.
https://chromedevtools.github.io/devtoo ... t/Browser/
Post Reply