There is a feature request already <https://xojo.com/issue/59961> but Xojo seems to be moving in the opposite direction. They completely removed the renderer option in the new DesktopHTMLViewer control, so itâs always CEF on Windows.
But Iâve been reconsidering my position on WebView2. I do use the MBS option, but I get lots of strange behavior that ends up making the control more problematic than just using CEF. I do things like check for to make sure support is actually available on the system, but I still get exceptions sometimes and the WebView2 installer needs to be rerun. Or itâll just hang sometimes. I have no way of determining if these are my bugs, MBS bugs, or WebView2 bugs. So Iâm less convinced WebView2 support is something thatâll actually be helpful.
In all honesty, if you were truly concerned with application size, Xojo wouldnât not be your best coding choice - apart from CEF even.
Solution for you -
Add an OLEContainer to your window, & in the opening event place the following -
Var v As Variant
Var params(1) As Variant
params(1) = "http://www.wikipedia.org/"
Me.ProgramID = "Shell.Explorer"
If Me.Create Then
Me.Content.Invoke("Navigate", params)
End If
me.Refresh(True)
Wallah - Black Magic OleContainer Code to load IExplorer control even though itâs no longer part of Xojo
Could always compile the WebView2 Active X control (wrapper) for C# then just load it in an OLEContainer Then you also have fully access to the underlying code should it need to be recompiled in C#?
If you want your app to check if WebView2 is installed, itâs pretty easy. I chose to incluide the âEvergreen Bootstrapperâ in my app (a 1.6MB EXE) Link
Your app can, upon opening, check to see if WebView2 is installed by checking AvailableCoreWebView2BrowserVersionString, and if itâs empty, put up a dialog asking if the user wants to install.
If they say yes, then you just launch the Bootstrapper EXE.
If you are going to mess around with DLLs, I would think youâd be better off using MBS Plugins.
I was trying to figure out if there was a way to use WebView2 in pure Xojo code (using OLE / ActiveX and/or Declares) but I never came up with a way. I think microsoft has not made WebView2 available as an OLE controlâŠ
Thaks but no thanks. For now the API 1 Native renderer works Ok. Im still NOT âdowngradingâ to the limited functionality API2 and will stay with Xojo 2019r2 until there are something worth the change.
Sure, there are options. It is just a shame Xojo cant keep up with the current technology