WebView2 and Cookies in Xojo
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:
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 an 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:
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:
Please try the functions and let us know whether they work well or you have questions.