I am developing an app on a banking device that uses cefsharp browser as a part of it. Cause this app will be used by anyone it should not save any data from previous user that the next user can see. I want to clear all cached browser data after closing it.
public void InitBrowser()
{
settings = new CefSettings();
settings.CachePath = AppDomain.CurrentDomain.BaseDirectory + "cache";
settings.CefCommandLineArgs.Add("disable-application-cache", "1");
settings.CefCommandLineArgs.Add("disable-session-storage", "1");
if (!Cef.IsInitialized) Cef.Initialize(settings);
webBrowser = new CefSharp.Wpf.ChromiumWebBrowser();
MainGrid.Children.Add(webBrowser);
}
I want to clear all cached data after a function named WebPages_Exit
is called. How can I remove all cached data without removing the browser instance or shutting down the CEF cause CEF can't be initialized twice and creating another instance of browser after disposing it is not working.
I implemented visit
function in ICookieVisitor
to save cookies as well and used methods like deleteCookies
or disabling cache cefSetting command, but nothing works cause cookies list is empty and visit
function of IcookieVisitor
is never called. it seems that it is saved in another part and just resets when CEF will shutdown.
DeleteCookies()
will just delete cookies, not cached data such as css, js, etc. For that I think you need to useBrowser.GetBrowser.Reload(True)
– Amphiboly