Configuring WebBrowser global settings

Use WebBrowserSet and WebBrowserGet to configure the following settings for the WebBrowser control:

  • RuntimeMode -- The runtime mode of WebView2. For description of this setting, refer to the section called Choosing a WebView2 runtime version.

  • FixedVersionRuntimePath -- The path of WebView2 Runtime Fixed Version. For description of this setting, refer to the section called Choosing a WebView2 runtime version.

  • DownloadPath -- The default download path.

  • allow-file-access-from-files -- Whether to allow access to the local files (XML etc.). 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.

  • 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.

  • remote-debugging-port -- Whether to specify a port number that allows remote debugging of the current URL. When the remote debugging port is enabled, it allows developers to connect to the URL using a debugger and inspect its internal workings.

  • remote-allow-origins -- Which origins or domains are allowed to access the resource on a server.

Note

The above settings (except DownloadPath) must be set before the window that contains the WebBrowser control is opened. You can set them in the application Open event, or in any event that is triggered earlier than the window that contains the WebBrowser control is opened.

The remote-allow-origins, and remote-debugging-port settings should be used only when the application is in the debug mode. For optimal performance, please comment out these settings when the application is not in the debug mode.

If you have run the application (that includes the WebBrowser control) from PowerBuilder IDE, you may need to restart PowerBuilder IDE before the program can successfully initialize the WebBrowser control again.