Use the Cog browser to access Digi Embedded Yocto WPE WebKit functionality.

To control the browser from the command line, run Cog in the background:

# cog &

The browser runs the connectcore-demo-example web application by default. From this web application, you can monitor and control your device and test the hardware acceleration capabilites of WebKit. See Step 6 - Access your device locally.

You can also open a different webpage by specifying its URL when executing Cog, such as:

# cog www.digi.com &

Cog displays the web page in fullscreen mode with no toolbars or navigation buttons. To navigate to a new URL or go to the previous page, use the cogctl CLI application. This application communicates with the Cog process via D-Bus and allows you to execute the following commands:

# cogctl help
Available commands:
  appid      Display application ID being remotely controlled
  objpath    Display the D-Bus object path being used
  help       Obtain help about commands
  open       Open an URL
  previous   Navigate backward in the page view history
  next       Navigate forward in the page view history
  ping       Check whether Cog is running
  quit       Exit the application
  reload     Reload the current page

For example, to go back to the previous page:

# cogctl previous

Configure the Cog browser

Cog configuration options allow you to modify the browser’s features and performance. To view all available parameters, run:

# cog --help-all
Usage:
  cog [OPTION?] [URL]

[...]

WebKitSettings options can be used to configure features exposed to the loaded Web content.

  BOOL values are either 'true', '1', 'false', or '0'. Omitting the value implies '1'.
  INTEGER values can be decimal, octal (prefix '0'), or hexadecimal (prefix '0x').
  UNSIGNED values behave like INTEGER, but negative values are not accepted.
  FLOAT values may optionally use decimal separators and scientific notation.
  STRING values may need quoting when passed from the shell.

  --allow-file-access-from-file-urls=BOOL                     Whether file access is allowed from file URLs.
  --allow-modal-dialogs=BOOL                                  Whether it is possible to create modal dialogs
  --allow-top-navigation-to-data-urls=BOOL                    Whether or not top frame navigation is allowed to data URLs
  --allow-universal-access-from-file-urls=BOOL                Whether or not universal access is allowed from the context of file scheme URLs
  --auto-load-images=BOOL                                     Load images automatically.
  --cursive-font-family=STRING                                The font family used as the default for content using cursive font.
  --default-charset=STRING                                    The default text charset used when interpreting content with unspecified charset.
  --default-font-family=STRING                                The font family to use as the default for content that does not specify a font.
  --default-font-size=UNSIGNED                                The default font size used to display text.

[...]

Application Options:
  --version                                                   Print version and exit
  --print-appid                                               Print application ID and exit
  --scale=FACTOR                                              Zoom/Scaling factor applied to Web content (default: 1.0, no scaling)
  --device-scale=FACTOR                                       Output device scaling factor (default: 1.0, no scaling, 96 DPI)
  --doc-viewer                                                Document viewer mode: optimizes for local loading of Web content. This reduces memory usage at the cost of reducing caching of resources loaded from the network.
  -d, --dir-handler=SCHEME:PATH                               Add a URI scheme handler for a directory
  --webprocess-failure=ACTION                                 Action on WebProcess failures: error-page (default), exit, exit-ok, restart.
  -C, --config=PATH                                           Path to a configuration file
  -b, --bg-color=BG_COLOR                                     Background color, as a CSS name or in #RRGGBBAA hex syntax (default: white)
  -P, --platform=NAME                                         Platform plug-in to use.
  -O, --platform-params=PARAMS                                Comma separated list of platform parameters.
  --web-extensions-dir=PATH                                   Load Web Extensions from given directory.
  --ignore-tls-errors                                         Ignore TLS errors (default: disabled).
  -F, --content-filter=PATH                                   Path to content filter JSON rule set (default: none).
  -s, --enable-sandbox                                        Enable WebProcess sandbox (default: disabled).
  --automation                                                Enable automation mode (default: disabled).

WebKit uses caches to improve load times. In some cases, prolonged use of these caches can reduce the total memory available in the system, causing the browser (and the system) to slow down. The following Cog parameters can help solve memory issues associated with caching:

  • --enable-page-cache=false disables the page cache, which stores the state of pages you’ve visited.

  • --doc-viewer disables the resource cache, which stores resources that might be shared among different subpages in the same website (such as images and stylesheets).

While these parameters reduce the amount of memory taken up by caches, in some cases they do so at the cost of increased load times. These options are recommended when an embedded device’s total RAM is 1 GiB or smaller. Otherwise, slowdowns can occur after browsing several pages in succession.