Microsoft Edge WebView2 supports two runtime versions: Evergreen Runtime and Fixed Version. When using the WebBrowser control in your PowerBuilder application, you can determine which WebView2 runtime version to use with your application.
Which runtime version to use
If you are not sure which version to choose, you can view the following highlighted key factors, or refer to the Microsoft documentation Distribute your app and the WebView2 Runtime for the detailed information about the pros and cons of each version.
-
Evergreen Runtime
-
The Evergreen Runtime ensures that WebView2 Runtime is taking advantage of the latest features and security updates.
-
The Evergreen Runtime requires persistent Internet connection for automatic installation and updates.
-
In Windows 11 or later, the Evergreen Runtime is included as part of the Windows operating system; and it is updated automatically (when Internet connection is available). In Windows 10 or earlier, the Evergreen Runtime should be first installed using an online bootstrapper or an offline installer and then it will get updated automatically when Internet connection is available.
-
-
Fixed Version Runtime
-
The Fixed Version Runtime will not be automatically updated. It requires you to manage the update: either keep using the existing version or periodically update the version that is packaged and installed with the PowerBuilder application
-
The Fixed Version Runtime cannot be installed by using an installer, you will need to download and install the latest available version of the Fixed Version to the specified location so that it can be automatically packaged with the PowerBuilder application
-
Where to configure the runtime version
Use the following methods to configure which runtime version to use with the application.
Method 1 has precedence over Method 2.
-
Method #1: Configure the runtime version in the application script.
-
Method #2: Configure the runtime version in the PowerBuilder IDE.
Method #1: Configure the WebView2 Runtime version in the application script
In the application Open event, call the WebBrowserSet function to set the version:
long ll_Ret ll_Ret = WebBrowserSet ("RuntimeMode", 0) //0: Evergreen Runtime, 1: Fixed Version, 2: Fixed Version only if Evergreen runtime is not available
Method #2: Configure the WebView2 Runtime version in the PowerBuilder IDE
In the Application painter, click Additional Properties on the General tab page in the Properties view; and then in the Application dialog box that displays, select the WebBrowser tab.
-
Always use the Evergreen Runtime at the client
This option is selected by default. When this option is selected, the Evergreen Runtime that is automatically installed and updated on Windows will be used. If the client has no Evergreen Runtime installed, the client will be prompted to install the Evergreen Runtime from the URL specified in the "WebView2 Runtime Download URL" field.
-
Always use the Fixed Version at the client
When this option is selected, you will need to manually download and install the Fixed Version of the WebView2 Runtime (from https://developer.microsoft.com/en-us/microsoft-edge/webview2/) to the location shown in the "WebView2 Runtime Fixed Version" group, normally %systemdrive%\Program Files (x86)\Appeon\Common\PowerBuilder\Runtime [version]\PBWebView2.
After that, the Fixed Version will be packaged with your PowerBuilder application and then installed to the client automatically.
-
Use the Evergreen Runtime by default; if it does not exist, use the Fixed Version
The Evergreen WebView2 Runtime will be used by default, but if it does not exist, the Fixed Version Runtime will be used instead.
Where to get the WebView2 Runtime Fixed Version at the client
Applications that use the WebView2 Runtime Fixed Version will search for the WebView2 runtime files in the following precedence order.
-
The precedence order in the development environment
-
The path specified in FixedVersionRuntimePath of the WebBrowserSet function.
-
The directory where the application executable file is located.
-
The PowerBuilder Runtime directory under the build number selected in the PowerBuilder IDE > Tools menu > System Options dialog.
-
-
The precedence order in the production environment
-
The path specified in FixedVersionRuntimePath of the WebBrowserSet function.
-
The directory where the application executable file is located.
-
The PowerBuilder Runtime directory specified in the configuration file (executable-name.xml).
-
The PowerBuilder Runtime directory stored in the system registry.
-
The PowerBuilder Runtime directory specified in the PATH environment variable (if any)
-
How to write PowerScripts to check if Evergreen Runtime is installed
You can add the following scripts to the Application Open event to check if the WebView2 Evergreen Runtime has been installed on the client.
If Evergreen Runtime is not installed, the end user will be prompted and the Web browser will be opened to display the download page.
Integer ll_Return string ls_location, ls_path_64bit, ls_path_user, ls_path_32bit, ls_Url ls_path_64bit = "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" ls_path_user = "HKEY_CURRENT_USER\Software\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" ls_path_32bit = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" ls_Url = "https://developer.microsoft.com/en-us/microsoft-edge/webview2/" //64 OS ll_Return = RegistryGet( ls_path_64bit, "location", RegString!, ls_location) //user(64 & 32) If ll_Return <> 1 Then ll_Return = RegistryGet( ls_path_user, "location", RegString!, ls_location) End If //32 OS If ll_Return <> 1 Then ll_Return = RegistryGet( ls_path_32bit, "location", RegString!, ls_location) End If //ls_location = C:\Program Files (x86)\Microsoft\EdgeWebView\Application If Pos(ls_location, "EdgeWebView" ) <= 0 Then If MessageBox("WebView2 Runtime not installed", & "Install the WebView2 Runtime from the following URL:~r~n" + ls_Url + "~r~nInstall now?", Question!, YesNo!, 2) = 1 Then //Open the URL in the defautlt browser OpenUrl(ls_Url) End If Return End If
Packaging and deploying WebView2 Runtime
For how to package and deploy WebView2 Runtime, refer to the section Packaging WebBrowser.