Since developers started to use it, we run into feature wishes. So let's go through a few points:
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.
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.
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.
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.