Since the embedded web area utilizes CEF as its web browser engine, there have been requests for a method to incorporate additional CEF switches, like the autoplay-policy switch, during the area initialization.
Starting with 4D 20 R6, you can manage your custom parameters using a parameter file.
If you are in a development environment, you need to copy your parameter file to:
- “C:\Users\xxxxxx\AppData\Roaming\4D\4DCEFParameters.json” on Windows
- “$HOME/Library/Application Support/4D/4DCEFParameters.json” on macOS
and for the engine applications, you need to copy the file in the project resource folder.
The file must have the following structure:
{
"switches":{
"key":value
},
"macOS":{
"switches": {
"key":value
}
},
"windows": {
"switches": {
"key":value
}
}
}
With the macOS and Windows object, you can define switches to be used only on a specific platform.
For example, if you want to allow the auto play for sound or video that needs the “autoplay-policy=no-user-gesture-required” switch to be activated, just copy the following parameter file:
{
"switches": {
"autoplay-policy": "no-user-gesture-required",
}
}
If you need to pass parameters that don’t need value, like the “enable-print-preview” just use “true” as a value to enable it:
{
"switches": {
"autoplay-policy": "no-user-gesture-required",
"enable-print-preview": true
}
}
Warning: Keep in mind that the switches are applied for all the embedded areas used in 4D such as 4D View Pro. So it can apply the proper functioning of 4D or your applications. If you want to have an overview of the list of available switches, you can have a look at the list proposed by Peter Beverloo: List of Chromium Command Line Switches.
With 4D 20 R6, fine-tuning embedded web area switches becomes easy using a parameter file, “4DCEFParameters.json”. For ease of implementation, developers can refer to the provided documentation detailing the structure and usage of the parameter file.