Closed ztextplus closed 1 year ago
This has come up before and the response was you need to do it on your own by deleting the data from user folder.
Hi @ztextplus, I'd like to understand your use case some more. Do you mind expanding on what your app is trying to do and how its planning on using incognito mode? Is your app a browser, trying to replicate edge's incognito experience?
@jasonstephen15 We use Webview2 in our client to run web applications. If the user logs in to our client and does not choose to save the username and password, we want to run Webview2 in incognito mode so that no cache data will be saved to the file.
We tried to delete the cache folder when we exited, but because the cache folder is occupied by Webview2, it cannot be deleted successfully every time.
Does an api to manage/clear cache work for your purposes? Assuming this api works during runtime would it be a workaround to a full fledged 'incognito mode'?
@jasonstephen15 If Webview2 can provide an API, it is also an acceptable solution, because Webview2 itself can release the file occupation first, and then clear the cache files.
I'm also searching for Incognito support in order to avoid the IIS Windows Authentication with the credentials of the logged on user. Do you have any idea how can I do so?
Hi @jasonstephen15, I also want to avoid caching entirely.
My use case is we that are providing user tablets that allow access to PII with HIPAA style regulations on privacy. The tablets are deployed in a kiosk style mode where the end user shell is the browser app. We do not want any caching on disk so if a tablet is lost we have not lost PII (we can revoke device access to the backend resources at the server side).
Currently we are using the cefsharp browser component with the in memory cache backend but would like to move to webview2 evergreen to use the windows update process to keep the browser component patched.
Providing the same in memory cache as cefsharp by default would also help with #297 and possibly #299
What does HIPAA say about the swap file? Do you disable the swap file to prevent PII from getting written there? You probably will need to create a RAM disk to use as a cache location. Modern browsers just won't function without some kind of cache, but I'm in a similar position. Our app is also kiosk mode and so need to eliminate personal information from just auto-filling. With all the privacy concerns these days I'm surprised Edge team is so careless with it. But that's more an Edge issue and WebView2 team is trying to work around their decisions.
Do we have an ETA for this feature ?
@jasonstephen15 , do we have an ETA for this feature ?
We use Webview2 in our client to run web applications. If the user logs in to our client and does not choose to save the username and password, we want to run Webview2 in incognito mode so that no cache data will be saved to the file.
We tried to delete the cache folder when we exited, but because the cache folder is occupied by Webview2, it cannot be deleted successfully every time.
Same here as well, do we know when would this feature be available, I see the last update in Dec 2020
@david-risney , any update on this feature.
We may be looking into it in the near future. I don't have any specific dates though.
wait for this
Why not just run from a new temporary user data folder in that case? Something like this before creating the webview:
Environment.SetEnvironmentVariable("WEBVIEW2_USER_DATA_FOLDER", Path.Combine(Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData), "Incognito", new Random().Next().ToString())));
Also, I'm not sure if that suffices but for real incognito you should also disable MS SmartScreen:
Environment.SetEnvironmentVariable("WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS", "--disable-features=msSmartScreenProtection");
Why not just run from a new temporary user data folder in that case? Something like this before creating the webview:
Environment.SetEnvironmentVariable("WEBVIEW2_USER_DATA_FOLDER", Path.Combine(Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData), "Incognito", new Random().Next().ToString())));
Also, I'm not sure if that suffices but for real incognito you should also disable MS SmartScreen:
Environment.SetEnvironmentVariable("WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS", "--disable-features=msSmartScreenProtection");
Thank you, you are a genius! I can now use multiple MSAL accounts to login and use them for the Graph API.
Any news on this? The above solution is OK, but not what I would expect from the API. We should have something like
webView.EnableIncognito = true;
or
webView.ClearChache();
Thanks
I am waiting for private mode too or clear cache/cookies. Any updates on this feature request?
InPrivate is supported via the CoreWebView2ControllerOptions.IsInPrivateModeEnabled
How to use it in a WPF application with a WebView2 control in it? Can you point to any documentation? As far as I have researched, ControllerOptions are not available for the control.
For WPF you can initialize the control using EnsureCoreWebView2Async(CoreWebView2Environment, CoreWebView2ControllerOptions) instead of using the Source property. https://learn.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.wpf.webview2.ensurecorewebview2async?view=webview2-dotnet-1.0.1518.46#microsoft-web-webview2-wpf-webview2-ensurecorewebview2async(microsoft-web-webview2-core-corewebview2environment-microsoft-web-webview2-core-corewebview2controlleroptions)
It's available now..?
@champnic is it available now, if yes could you share link for samples
Yes this is available now. I linked the APIs above, and here is the sample (in Win32): https://github.com/MicrosoftEdge/WebView2Samples/blob/1710d535e895ed9c24196c5482e990e10d7285c7/SampleApps/WebView2APISample/AppWindow.cpp#L1343
I need WebView2 to support incognito mode. Is there a solution?
AB#31044529