Skip to content

Chrome settings

Czarek Tomczak edited this page Jan 6, 2017 · 5 revisions

These are the settings that can be found in the "chrome" section in the "settings.json" file. See also the Settings wiki page.

Table of Contents generated with DocToc

cache_path

Default value: "webcache"

The directory where cache data will be stored on disk. If set to empty string, an in-memory cache will be used and your cookies and other data (like HTML5 databases) will not persist across app launch sessions. Chrome flushes cache data to disk every 30 seconds or so.

command_line_switches

Default value: {}

There are many settings that can be customized through Chrome command line switches. These switches can only be set programmatically in the settings.json file, by passing a dictionary of switches, with switch name as a key. The switch name should not contain the "-" or "--" prefix, otherwise it will be ignored. Switch value may be an empty string, if the switch doesn't require a value. These switches are set only for the main browser process.

See the peter.sh website for an assembled list of all Chrome switches: http://peter.sh/experiments/chromium-command-line-switches/

See also CEF switches in the cef_switches.cc file.

Example code in settings.json:

command_line_switches: {
    "lang": "fr",
    "enable-media-stream": "",
    "enable-system-flash": ""
},

Example switches:

  • {"lang": "fr"} - The language file that we want to try to open. Of the form language[-country] where language is the 2 letter code from ISO-639. See locales/ directory for a full list of supported languages.
  • {"enable-media-stream": ""} - Enables media streaming (WebRTC audio/video).
  • {"enable-system-flash": ""} - Enables Flash. Additionally you need to install PPAPI system-wide plugin.
  • {"enable-speech-input": ""} - Enable speech input (x-webkit-speech).
  • {"disable-web-security": ""} - Don't enforce the same-origin policy.
  • {"proxy-server": "socks5://127.0.0.1:8888"} - To set custom proxy. See also Proxy Resolution in upstream CEF.
  • {"no-proxy-server": ""} - By default Chromium uses the IE proxy settings (set in Internet Explorer options). To disable use of that proxy set the "no-proxy-server" Chromium switch. See also Proxy Resolution in upstream CEF.

These switches can also be set from command line when launching the phpdesktop executable, for example "phpdesktop-chrome.exe --enable-media-stream". This can be useful to quickly test some of the switches without being forced to edit the settings.json file. Also when combined with the ability to pass CGI environment variables as command line arguments you are capable of creating multiple phpdesktop browser windows with a mix of different settings to fulfill your application specific needs.

context_menu

Default value: {}

The mouse context menu is configurable using the following options:

  • enable_menu - whether to enable context menu.
  • navigation - whether to show the "Back", "Forward" and "Reload" options.
  • print - whether to show the "Print..." option.
  • view_source - whether to show the "View source" option.
  • open_in_external_browser - whether to show the "Open page in external browser" and "Open frame in external browser" options.
  • devtools - whether to show the "Show Developer Tools" option. See also the "devtools_F12" option. You have to set the "remote_debugging_port" option for the developer tools to be available.

devtools_F12

Default value: true

Developer tools will open when pressing the F12 key. See also the ["context_menu"]["devtools"] option. You have to set the "remote_debugging_port" option for the developer tools to be available.

external_drag

Default value: true

Whether to allow external drag events to enter the browser window. For example an url is dragged and navigation occurs, or a file is dragged and its contents are displayed.

There are methods for detecting what type of element is dragged into the window, in future we might allow filtering and allowing some type of the drag events, see Issue #91.

BUG NOTICE: This also controls internal drag and drop events on websites, see Issue #97.

external_navigation

Default value: true

Whether to allow navigation to exernal websites inside PHP Desktop browser. When set to false external links will be opened in OS default browser. This behavior applies in general to external navigation, so this gets fired not only when clicking a link, but also when doing a redirect (whether it is initiated from php or from javascript using the window.location object).

log_file

Default value: "debug.log"

The directory and file name to use for the debug log. If empty, the default name of "debug.log" will be used and the file will be written to the application directory.

log_severity

Default value: "default"

The log severity. Only messages of this severity level or higher will be logged. Also configurable using the "log-severity" command-line switch with a value of "verbose", "info", "warning", "error", "error-report" or "disable". The default is "info".

reload_page_F5

Default value: true

Reloading page with cache ignored will be available under the F5 key. See also the ["context_menu"]["reload_page"] option.

remote_debugging_port

Default value: 0

Port for remote debugging. A value between 1024 and 65535 is accepted. A value of 0 will generate a random port. A value of -1 will disable remote debugging.