Fired before the Chromium Embedded Browser sub-processes are created.
A Settings object used for providing special CEF Browser initialization flags.
For a list of command line switches please have a look here: https://peter.sh/experiments/chromium-command-line-switches
Default WebKitX CEF3 Command Line Switches are:
CommandLineSwitches |
Copy Code |
---|---|
-allow-file-access -allow-file-access-from-files -allow-insecure-localhost -allow-running-insecure-content -allow-silent-push -always-authorize-plugins -cipher-suite-blacklist=0x0005,0x0004,0x002f,0xc012,0xc011,0x003c,0xc011,0x0032,0xc007,0xc00c -disable-domain-blocking-for-3d-apis -disable-machine-cert-request -disable-origin-chip -enable-async-dns -enable-download-resumption -enable-encrypted-media -enable-es3-apis -enable-experimental-canvas-features -enable-font-antialiasing -enable-smooth-scrolling -enable-webgl-draft-extensions -expose-internals-for-testing -ignore-certificate-errors -ignore-gpu-blacklist -ignore-urlfetcher-cert-requests -javascript-harmony -print-to-pdf -reduce-security-for-testing -repl -save-page-as-mhtml -ssl-version-min=tls1 |
Performance Tips |
Copy Code |
---|---|
Private Sub Editor_OnCreate(ByVal Settings As WebKitXCEF3Lib.ISettings, CommandLineSwitches As String) On Error Resume Next With Settings .app_path = FS.GetAbsolutePathName(App.Path) .accept_language_list = "es-CL,en-GB" .persist_session_cookies = 0 .persist_user_preferences = 0 .show_context_menu = False .asynchronous_com_events = True End With CommandLineSwitches = CommandLineSwitches + " --no-proxy-server --disable-cache --disable-gpu-program-cache --disable-gpu-shader-disk-cache" CommandLineSwitches = CommandLineSwitches + " --disable-background-networking --disable-background-timer-throttling --disable-backgrounding-occluded-windows" CommandLineSwitches = CommandLineSwitches + " --disable-breakpad --disable-client-side-phishing-detection --disable-default-apps --disable-dev-shm-usage " CommandLineSwitches = CommandLineSwitches + " --disable-renderer-backgrounding --disable-sync --metrics-recording-only --no-first-run --no-default-browser-check" End Sub |
Fired before the Chromium Embedded Browser sub-processes are created.
Visual Basic |
---|
Public Event OnCreate( _ ByVal Settings As Settings, _ ByRef CommandLineSwitches As String _ ) |
A Settings object used for providing special CEF Browser initialization flags.
For a list of command line switches please have a look here: https://peter.sh/experiments/chromium-command-line-switches
Default WebKitX CEF3 Command Line Switches are:
CommandLineSwitches |
Copy Code |
---|---|
-allow-file-access -allow-file-access-from-files -allow-insecure-localhost -allow-running-insecure-content -allow-silent-push -always-authorize-plugins -cipher-suite-blacklist=0x0005,0x0004,0x002f,0xc012,0xc011,0x003c,0xc011,0x0032,0xc007,0xc00c -disable-domain-blocking-for-3d-apis -disable-machine-cert-request -disable-origin-chip -enable-async-dns -enable-download-resumption -enable-encrypted-media -enable-es3-apis -enable-experimental-canvas-features -enable-font-antialiasing -enable-smooth-scrolling -enable-webgl-draft-extensions -expose-internals-for-testing -ignore-certificate-errors -ignore-gpu-blacklist -ignore-urlfetcher-cert-requests -javascript-harmony -print-to-pdf -reduce-security-for-testing -repl -save-page-as-mhtml -ssl-version-min=tls1 |
Performance Tips |
Copy Code |
---|---|
Private Sub Editor_OnCreate(ByVal Settings As WebKitXCEF3Lib.ISettings, CommandLineSwitches As String) On Error Resume Next With Settings .app_path = FS.GetAbsolutePathName(App.Path) .accept_language_list = "es-CL,en-GB" .persist_session_cookies = 0 .persist_user_preferences = 0 .show_context_menu = False .asynchronous_com_events = True End With CommandLineSwitches = CommandLineSwitches + " --no-proxy-server --disable-cache --disable-gpu-program-cache --disable-gpu-shader-disk-cache" CommandLineSwitches = CommandLineSwitches + " --disable-background-networking --disable-background-timer-throttling --disable-backgrounding-occluded-windows" CommandLineSwitches = CommandLineSwitches + " --disable-breakpad --disable-client-side-phishing-detection --disable-default-apps --disable-dev-shm-usage " CommandLineSwitches = CommandLineSwitches + " --disable-renderer-backgrounding --disable-sync --metrics-recording-only --no-first-run --no-default-browser-check" End Sub |
OnCreate event provides you a Settings object that controls CEF3 Application and CEF3 Browser creation and initialization settings. The recommended defaults are preset in this object but you may want to provide your own settings such as Localization, Cache paths, Security settings, etc. The second parameter is CommandLineSwitches that are additional CEF3 preferences and even JavaScript flags that you want to provide to CEF3 Client Processes.
WebKitX provides several Events during its initialization, creation of the browser and loading of a URL. First you need to set the licensing information by handling the early Form Loading or Creation event. Then you can control CEF Browser creation by handling the OnCreate event. Once the browser is ready it will emit the the OnBrowserReady event where you can enable JavaScript or HTML5 editing parameters. In OnBrowserReady you should also load the HTML5 markup or navigate to the URL you want to load.
During loading WebKitX will fire several loading events such as OnLoadStart and OnLoadEnd. If you are loading HTML with frames (IFRAMEs) then some events will fire multiple times, such as OnPageLoadStart and OnPageLoadEnd. When the main frame is loaded WebKitX will fire OnLoadEnd and when all frames have loaded WebKitX will fire the OnPageComplete event.
When you receive the OnLoadEnd and OnPageLoadEnd events, it means that network-wise the contents have downloaded but HTML-wise the contents might not be fully parsed yet. In HTML terms this means that document.readyState value might not not set to complete. Pages in window or sub frames might be in interactive state and resources might be loading in the background. The only event that guarantees that the main window frame and all sub-frames have document.readyState = complete is OnPageComplete.
Internally, WebKitX uses an asynchronous task that checks the document.readyState for all frames; if this check result is "complete" with a count equal to browser frames, then the event is fired. If some frames have loaded while other frames have failed, the event will not fire. The check takes place on a fresh HTML DOM snapshot obtained every time at the moment of the check, and examines the current number of frames. The frames must remain unchanged for 3 seconds before the event is fired; this way, any dynamic loading or unloading of frames is taken into account.
Please note that some frameworks such as Angular and React dynamically load portions of the page. WebKitX events will keep firing while dynamic content is downloaded. You need to examine the behavior of the control in relation with the web site you want to display and adjust your event handling accordingly.
Private Sub WebKitX1_OnCreate(ByVal Settings As WebKitXCEF3Lib.ISettings, CommandLineSwitches As String) On Error Resume Next WebKitX1.IPC_TIMEOUT_MILLIS = 5000 ' Set the cache path Settings.cache_path = App.Path + "\MyCache" ' Set the application cache path Settings.application_cache = App.Path + "\MyAppCache" ' Enable cookies Settings.persist_session_cookies = 1 ' Persistent user preferences Settings.persist_user_preferences = 1 ' Enable plugins (eg. PDF viewer) Settings.plugins = True ' Enable flash plugin, place dll in same ' folder with ocx or provide explicit path 'Settings.flash_player_dll_path = "pepflashplayer32_29_0_0_113.dll" ' Disable WebGL (used in VM/Citrix terminals for better performance) 'Settings.webgl = False ' Disable context menu Settings.show_context_menu = True ' Additional switches, have a look here: ' https://peter.sh/experiments/chromium-command-line-switches/ AddLog "CommandLineSwitches=" + CommandLineSwitches ' Enable HTML XML (but it really messes with local <script> elements 'Settings.enable_xml_html = True '====================================================================== ' Enabling content filtering is experimental and forces UTF-8 encoding ' https://bitbucket.org/chromiumembedded/cef/issues/1906/cef-ignores-content-type-charset-option '====================================================================== ' Filter Response Headers Settings.filter_response = True ' Overwrite CORS Settings.access_control_allow_origin = "*" ' Remove Security Policy Headers Settings.remove_response_headers = "x-webkit-csp,content-security-policy,x-content-security-policy" ' Supress JavaScript dialogs eg. alert() Settings.javascript_supress_dialogs = True End Sub
private void WebKitXCEF31_OnCreate(object sender, AxWebKitXCEF3Lib._DWebKitXCEF3Events_OnCreateEvent e) { WebKitXCEF31.IPC_TIMEOUT_MILLIS = 5000; e.settings.cache_path = Application.StartupPath + "\\MyCache"; e.settings.application_cache = Application.StartupPath + "\\MyAppCache"; e.settings.persist_session_cookies = 1; e.settings.persist_user_preferences = 1; e.settings.plugins = true; e.settings.webgl = true; e.settings.show_context_menu = true; AddLog("CommandLineSwitches=" + e.commandLineSwitches); }
WebKitXCEF3 Object | WebKitXCEF3 Members | Settings Object | Create Method