WebBrowserSet

Description

Configures the settings for the WebBrowser control. The global settings are also configured.

Note that some settings must be set before the WebBrowser control is initialized. These settings should be set in the application Open event.

Syntax

WebBrowserSet (string n, string v)

Argument

Description

n

The name of the setting that is case insensitive. The setting can be:

Note

The settings including RuntimeMode, FixedVersionRuntimePath, allow-file-access-from-files, UserDataFolder, Language, and UserAgent must be set before the WebBrowser control is initialized. It is recommended that you set it in the application Open event. If you have run the application (that includes the WebBrowser control) from PowerBuilder IDE, you may need to restart the application and the PowerBuilder IDE before the program can successfully initialize the WebBrowser control again.

  • RuntimeMode -- The distribution mode of WebView2 Runtime. This setting has a higher precedence than the setting in the IDE > Application properties dialog box.

  • FixedVersionRuntimePath -- The path of WebView2 Runtime Fixed Version. Both the relative path and absolute path are supported.

  • DownloadPath -- The default download path. Both the relative path and absolute path are supported. By default, the system default download path will be used, for example, "C:\Users\appeon\Downloads" in 64-bit Windows 10.

  • allow-file-access-from-files -- Whether to allow access to the local files (XML etc.). The value is "true" or "false" (the default). allow-file-access-from-files must be used with UserDataFolder, and each application must have its own UserDataFolder, otherwise WebBrowser may not work properly.

  • UserDataFolder -- The folder that stores user data. Both the relative path and absolute path are supported. The default user data folder is %temp%\PB220UDF in the development machine and %temp%\<appname>UDF at the client.

  • Language -- The language of WebBrowser control to be set.

  • 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. The default value of UserAgent cannot be obtained until the WebBrowser control is initialized and created.

v

The value of the setting to be set.

  • When the name of the setting is "RuntimeMode", the following values can be specified:

    0 -- Use the WebView2 Evergreen Runtime.

    1 -- Use the WebView2 Runtime Fixed Version.

    2 -- Use the WebView2 Evergreen Runtime by default; if it does not exist, use the Fixed Version. If you modify this value, you must restart PowerBuilder IDE and the application for the value to take effect; and this value has a higher precedence than the setting in the IDE > Application properties dialog box.

  • When the name of the setting is "Language", this value is used to set the language in the UI of WebBrowser control, such as the context menu and the default dialog box. And it is also used in the accept-languages HTTP request header sent to the website.

    The format is language[-country] in which language is a two letter code in ISO 639 and country is a two character code in ISO 3166.

  • When the name of the setting is "UserDataFolder", this value is used to set the user data directory.


Return value

Integer.

Returns 1 if the function succeeds and a negative value if an error occurs. If any argument's value is null, the method returns null.

Examples

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

long ll_Ret

ll_Ret =WebBrowserSet("Language", "de-DE")

See also

WebBrowserGet