Description
Is your feature request related to a problem? Please describe.
Hello. This feature request is inspired by this Twitter thread: https://twitter.com/aluhrs13/status/1679145646706810882
I'm using WebView2 via its .NET/WPF wrapper in a desktop application. Its purpose there is very limited: I'm using it to a display a Google login page, have the user enter and confirm their credentials, and then extract the received cookies to use for further (non-webview) HTTP requests.
For context, this is used in https://github.com/Tyrrrz/YoutubeDownloader in order to download private playlists and videos. It's not possible to use OAuth or other "native" ways of authentication to achieve this, since downloading videos is not exactly a scenario supported by YouTube. So using an actual browser, as in WebView, is the only way to do it.
Because of my use case, I really don't need to persist any user data between sessions. Ideally, I want WV2 to be able to run completely in-memory and unload immediately as it becomes unneeded (i.e. when the user finishes logging in). Currently, this is not the case, as WebView2 leaves a noticeable footprint on disk, where it stores the user profile.
The closest thing to what I want appears to be the InPrivateMode
switch, but even when using it, I found that WebView2 still creates a user profile and persists certain files on disk. The issue is that the user folder occupies a significant amount of space that seems to increase over time, and my limited usage scenario does not require it whatsoever.
Describe the solution you'd like and alternatives you've considered
I would propose a similar switch to InPrivateMode
, except something like InMemoryMode
. When it's enabled, WebView should store all user data in-memory and not persist anything on disk.
To my knowledge (and from my discussion with @aluhrs13), this does not appear to be an existing API.
Let me know if you need more context or any other information that may be useful.