You may use the HTMLViewer in Xojo for your desktop projects. It uses on Windows either Chromium CEF in some version or the older Internet Explorer component. While the IE component is certainly old and outdated, the CEF version coming with your Xojo may also be older and considerably increases your application size. For CEF you carry about 200 MB of DLLs with you. Looking for an alternative, we got a WebView2 control in MBS Plugins:
We got our WebView2ControlMBS for Xojo based on the WebView2 control from Microsoft.
Once you have a WebView2 control, you can define in the Configure event the data folder to use. See UserDataFolder property to put in a folder, which may go to application data folder and define where to store the web view files like caches. Here is a sample code for the Configure event:
EventHandler Sub Configure() System.DebugLog CurrentMethodName Dim folder As FolderItem = SpecialFolder.ApplicationData.Child("MyApp") folder.CreateAsFolder Me.UserDataFolder = folder.NativePath End EventHandler
In our test machine the path is “C:\Users\cs\AppData\Roaming\MyApp” and inside we find a folder EBWebView. If you like to make a browser to forget all settings, caches and cookies, you a simply later delete the folder after you closed the control.
Each WebView2ControlMBS has an associated cookie manager, which you can query via the CookieManager function. It returns you a WebView2CookieManagerMBS object, that provides commands to query cookies like this:
Function CommandsCookies() As Boolean Dim cookiemanager As WebView2CookieManagerMBS = web.CookieManager // get all cookies synchronously Dim cookies() As WebView2CookieMBS = cookiemanager.GetCookiesSync // show them in window CookiesWindow.show(cookiemanager, cookies) Return True End Function
You can of course create a cookie in your app, which is then included in requests to a specific domain, so you can pre-login your clients or pass some information with the request. Once you have cookies as WebView2CookieMBS objects, you can of course delete or change them. For example we have a cookies window in our example, where you can delete cookies with delete or backspace key:
EventHandler Function KeyDown(Key As String) As Boolean If Asc(key) = 8 Or Asc(key) = 127 Then // backspace or delete Dim SelectedRowIndex As Integer = Me.SelectedRowIndex If SelectedRowIndex >= 0 Then // we delete selected cookie Dim cookie As WebView2CookieMBS = Me.RowTagAt(SelectedRowIndex) cookiemanager.DeleteCookie cookie Me.RemoveRowAt(SelectedRowIndex) Return True End If End If End EventHandler
Please try the functions and let us know whether they work well or you have questions.