WebBrowserSet

Description

Configures the settings for the WebBrowser control.

Syntax

WebBrowserSet (string n, string v)

Argument

Description

n

The name of the setting. The setting can be:

  • CachePath -- The folder that stores the web page cache, cookies etc. You can specify a directory or use the default directory which uses the system environment %HOMEPATH% and %TEMP%, for example, C:\Users\appeon\AppData\Local\Temp\pbcefcache.

    CachePath must be set before the WebBrowser control is initialized. It must be an absolute path, and cannot be a relative path.

  • UserDataPath -- The folder that stores the user data dictionary. You can specify a directory or use the default directory which uses the system environment %HOMEPATH% and %TEMP%, for example, C:\Users\appeon\AppData\Local\pbcef\User Data\Dictionaries.

    UserDataPath must be set before the WebBrowser control is initialized. It must be an absolute path, and cannot be a relative path.

  • DownloadPath -- The folder that stores the downloaded files etc. You can specify a directory or use the default directory which uses the system environment %HOMEPATH% and %TEMP%, for example, C:\Users\appeon\AppData\Local\Temp\pbcefdownload.

    DownloadPath must be set before the WebBrowser control starts downloading files. It must be an absolute path, and cannot be a relative path.

  • UserAgent -- The User-Agent request header that contains a characteristic string that allows the network protocol peers to identify the application type, operating system, software vendor or software version of the requesting software user agent.

    UserAgent must be set before the WebBrowser control is initialized.

  • ProxyAuto -- Whether to use auto proxy detection. The value could be 1 or 0 (the default). Auto proxy detection is used if it is set to 1.

  • ProxyPacUrl -- The URL address of the PAC file. It is unsupported to load the PAC file on the local directory via file:/// (you will have to put the file on the server and load it via http or https).

  • ProxyAddress -- The address of the proxy server.

  • ProxyPort -- The port of the proxy server. The default value is -1.

  • ProxyUser -- The user name that will be authenticated by the proxy server.

  • ProxyPassword -- The password that will be authenticated by the proxy server.

    WebBrowser supports auto proxy detection, PAC (proxy auto configuration) file setting, and manual proxy settings. The priority order of the settings is: auto proxy detection > PAC file setting > manual proxy settings. By default the IE proxy is used.

    If the proxy setting is set before the WebBrowser control is initialized, it will be effective to all Web pages loaded; if it is set before the Navigate operation, then it will be effective to only the Web page being navigated.

v

The value of the setting to be set.


Return value

Integer.

Returns the following error code:

  • 1 -- Success

  • -7 -- CEF has been initialized, and the current item can only be set before CEF initialization.

  • -8 -- The setting name does not exist.

  • -9 -- The path is invalid or does not exist.

Examples

The following example configures the proxy settings for the WebBrowser control in the application Open event.

Open(string commandline)
{
    WebBrowserSet ("ProxyAddress", "192.168.5.16")
    WebBrowserSet ("ProxyPort", "8080")
    WebBrowserSet ("ProxyUser", "Admin")
    WebBrowserSet ("ProxyPassword", "123Test")
}

See also

WebBrowserGet