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.

GlobalCefApp params dont work

Post Reply
sebfischer83
Posts: 10
Joined: Mon Nov 30, 2020 6:37 am

GlobalCefApp params dont work

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

Re: GlobalCefApp params dont work

Post 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
sebfischer83
Posts: 10
Joined: Mon Nov 30, 2020 6:37 am

Re: GlobalCefApp params dont work

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

Re: GlobalCefApp params dont work

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