« Embracing for each lo… | Home | Black Friday coming s… »

WebView2 for Xojo upgrades

Since we created the WebView2ControlMBS control for Xojo based on the WebView2 control from Microsoft, we got quite a few things upgraded.

This control allows any Windows application to use the Chrome based Edge browser as a control within your application. Enjoy all the latest JavaScript, HTML and CSS features and replace use of Internet Explorer.

Since developers started to use it, we run into feature wishes. So let's go through a few points:

User Data

Please be sure to implement Configure event to set the UserDataFolder property to define where all the data is stored. If you delete this folder when the application quits, you basically get private browsing implemented.

New properties

We added quite a few properties to configure the browser. First you can use UserAgent property to change the name of the browser and maybe get by a website checking for what browser you are. Then you can decide whether passwords are saved, auto fille is enabled or whether the user can use pinch to zoom with supported hardware.

Copy & Paste

We added methods to select all, then do copy the text. Having methods for Copy, Cut and Paste is handy if you like to have menu entries in Xojo for them and forward the commands to the web viewer. You can use ClearSelection to clear selection or programmatically select all texts.


The print method allow you to offer menu or toolbar commands for starting printing. The PrintCompleted event fires when printing is done. Use that to enable any GUI, which you disabled for starting the print process. The WebView2PrintSettingsMBS class allows you to configure printing and decide which printer to use in what paper format. And best is the PrintToPDF method: You may for example create invoices as PDF, show them as preview in our WebView2ControlMBS control and then save as PDF to send to clients.

Virtual Host Mapping

You can use SetVirtualHostNameToFolderMapping function to use a folder on hard disk for a specific host. This way you may have pictures locally, which you'd normally load from your website.

Background Color

Use DefaultBackgroundColor function to set the background color for the webviewer for when showing transparent content. Default is white, but you could have some kind of gray color if needed.

New Window

We did add the NewWindowRequested event to allow you to process links requesting an URL loaded into a new window or tab. It can also be used to redirect the request and open the local browser app to show it. Just call ShowURL or System.GotoURL to open the URL in the browser and return true to indicate you handled it.


Please visit the WebView2 website and download the WebView2 Runtime installer there. There is a single installer to download whatever platform you are on or just get the Windows 32 or 64-bit Intel full installers. The control may come pre-installed for Windows 11 version, but users on older Windows versions need to install it manually. Your application can run the installer automatically if the browser component is missing.

Please do not hesitate to contact us with questions.
21 11 23 - 08:49