Page 1 of 1

GlobalCefApp params dont work

Posted: Fri May 28, 2021 4:04 pm
by sebfischer83
Hi,

I set in my application

Code: Select all

  GlobalCEFApp := TCefApplication.Create;
  GlobalCEFApp.SingleProcess := false;
  GlobalCEFApp.BrowserSubprocessPath := 'SubProcess.exe';
  GlobalCEFApp.IgnoreCertificateErrors := True;
  GlobalCEFApp.DisableSafeBrowsing := True;
  GlobalCEFApp.AllowRunningInsecureContent := True;
  GlobalCEFApp.DisableWebSecurity := true;
  GlobalCEFApp.PersistSessionCookies := True;
and also in my subprocess.
But IgnoreCertificateErrors and AllowRunningInsecureContent don't have any effect.
It's called before the GlobalCEFApp.StartMainProcess call.

Re: GlobalCefApp params dont work

Posted: Sat May 29, 2021 2:06 pm
by salvadordf
Please, download the latest CEF4Delphi version from GitHub to get GlobalCEFApp.IgnoreCertificateErrors working.

The GlobalCEFApp.AllowRunningInsecureContent property sets the --allow-running-insecure-content Chromium switch.

Apparently that switch doesn't work with all Chromium's versions but there are two workarounds :
  • Register HTTPS as a custom scheme.
  • Use CefAddCrossOriginWhitelistEntry. It's available in uCEFMiscFunctions. Read the code comments in this link to know more details about that function : https://bitbucket.org/chromiumembedded/cef/src/master/include/cef_origin_whitelist.h

Re: GlobalCefApp params dont work

Posted: Sat May 29, 2021 2:58 pm
by sebfischer83
Hi,

thanks for the answer.
But how does the custom scheme works?
Then I have to manually make the calls in my code and return the results over the handler?

Re: GlobalCefApp params dont work

Posted: Sun May 30, 2021 7:31 am
by salvadordf
Build the SchemeRegistrationBrowser demo, modify the registrar.AddCustomScheme call to register the "HTTP" scheme instead of "HELLO" and use CEF_SCHEME_OPTION_SECURE in the second parameter.

Read this document to know how to use the resource handler :
https://magpcss.org/ceforum/apidocs3/projects/(default)/CefResourceHandler.html

The registrar.AddCustomScheme can have these values in the "options" parameter :
https://bitbucket.org/chromiumembedded/cef/src/master/include/internal/cef_types.h#lines-2870