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.
Hello, there is a problem, there is a form on which there is a checkbox that disables or enables proxies, the problem is that proxies are enabled but after unchecking they are not disabled!.
The MiniBrowser demo has all the code to set or remove the proxy settings here :
https://github.com/salvadordf/CEF4Delphi/blob/6393b6f480725b1b279e944e5c26540bcf8c9192/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.pas#L1509
Many TChromium methods and properties will only work when the browser is fully initialized and ready to take commands.
TChromium.CreateBrowser is an asynchronous function and a few milliseconds later the TChromium.OnAfterCreated event is triggered.
You can call LoadURL and UpdatePreferences only after the OnAfterCreated event was triggered because the browser is fully initialized after that moment.
Use the TForm.OnCreate to set Chromium1.DefaultURL to the first address you want to navigate when the browser is fully initialized.
Use the TForm.OnCreate to set the default proxy settings : ProxyType, ProxyScheme, ProxyServer, etc
Call Chromium1.CreateBrowser
Wait until Chromium1.OnAfterCreated is triggered
If the user wants to navigate to another website he can do it now, after Chromium1.OnAfterCreated is triggered, with a call to Chromium1.LoadURL
If you need to change the proxy settings again do it after the Chromium1.OnAfterCreated event is triggered and call Chromium1.UpdatePreferences afterwards.
If you want to use a direct connection without a proxy server then set Chromium1.ProxyType to CEF_PROXYTYPE_DIRECT