Microsoft Edge WebView2 general availability!

Intro

Microsoft has recently announced general availability of the WebView2 embedded browser control, part of Microsoft Edge Chromium. https://blogs.windows.com/msedgedev/2020/10/19/edge-webview2-general-availability/. In this blog post, I want to summarize the steps you can take, to configure your or your customer’s environment, and making sure browser components that target the Microsoft Edge Chromium embedded WebView2 interfaces are properly initialized.

Microsoft Edge Chromium support is included in TMS FNC Core (TTMSFNCWebBrowser) & TMS VCL UI Pack (TAdvWebBrowser). Using one of those components requires you to follow 2 steps to get the browser up & running on your system.

1) Make sure Microsoft Edge Chromium is available on your system

When using one of the above components you need to make sure that Microsoft Edge Chromium is available on your system. There are 3 ways to make either TAdvWebBrowser or TTMSFNCWebBrowser pick up edge.

2) Copy the necessary DLLs to communicate with WebView2 embedded browser control

The second step is copying both WebView2Loader_x86.dll & WebView2Loader_x64.dll in to the system32 & sysWow64 folders. Both DLLs can be found in the installation folder, in a sub folder “Edge Support”. After copying both DLLs, to target 32 & 64 bit Windows applications, start the IDE (RAD Studio, or Lazarus), and drop an instance of TAdvWebBrowser or TTMSFNCWebBrowser. The message you will see that indicates the browser is properly initialized is displayed in the screenshot below. Depending on the chosen technique to install Microsoft Edge Chromium, or making sure Microsoft Edge Chromium is available on your system can slightly differ.

Deploying your application to your customer

When developing your application that uses a TAdvWebBrowser or TTMSFNCWebBrowser, you want to make sure it runs on the customer’s machine. When the customer has Windows updates turned on, Microsoft Edge Chromium should be available on his system. The implementation of TAdvWebBrowser or TTMSFNCWebBrowser checks if this is true, and automatically makes a copy to work with. So no additional steps are required there. Note that this process might take some time when the browser is dropped on the form for the first time, or your application is running for the first time. Each time an update is pushed from Windows updates, a new copy is made to a temporary folder. If you do not want this and you want your application initialization faster you can separately download and install the WebView2 Evergreen runtime (https://developer.microsoft.com/en-us/microsoft-edge/webview2/) on the customer’s machine. This will ensure a proper installation of Microsoft Edge Chromium ready to be used for an embedded browser control. Installing DEV, BETA or CANARY is not recommended when deploying your application. These insider builds are only for development purposes. More info about the application distribution is explained here: https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution