当前位置: 首页 > 编程语言 > C#

gecko清除缓存历史和Cookie分享

时间:2023-04-10 23:54:08 C#

gecko清除缓存历史和Cookie求助!我使用GeckoFx-Windows-10.0-0.6浏览器和xulrunner-10.0.en-US.win32。(VisualStudio2010c#)一切正常。但我需要像Firefox一样清除所有历史记录:工具>>选项>>隐私我发现Gecko.CookieManager.RemoveAll();有多清楚cookie是Gecko.CookieManager.RemoveAll();如何清除缓存、临时文件和历史记录?!当我初始化Gecko.Xpcom时,由于显而易见的原因,我无法清除文件夹“Gecko.Xpcom.ProfileDirectory”(缓存和cookie)。Gecko.Xpcom.Shutdown()没有帮助我找到了一种通过javascript清除cookie的方法:varcookieManager=Components.classes["@mozilla.org/cookiemanager;1"].getService(Components.interfa?ces.nsICookieManager);cookieManager.removeAll();如何在C#中调用这个JS?清除cookie需要查询如下接口:if(MessageBox.Show("是否要删除cookie?","即将删除所有cookie",MessageBoxButtons.YesNo,MessageBoxIcon.Information)==DialogResult.Yes){nsICookieManagerCookieMan;CookieMan=Xpcom.GetService("@mozilla.org/cookiemanager;1");CookieMan=Xpcom.QueryInterface(CookieMan);CookieMan.RemoveAll();在运行时拒绝访问缓存会导致安全等问题。这意味着您需要找到一种方法在程序关闭后删除这些文件夹等。创建另一个应用程序来处理它。对于它的价值,我回顾了一下,在GeckoFX29上至少历史遵循相同的模式:nsIBrowserHistoryhistoryMan=Xpcom.GetService(Gecko.Contracts.NavHistoryService);historyMan=Xpcom.QueryInterface(historyMan);historyMan.RemoveAllPages();不确定对Cache是??否正确:以上是C#学习教程:gecko清除缓存历史和cookies共享的所有内容。如果对大家有用,需要进一步了解C#学习教程,希望大家多多关注—//https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/imgICacheGecko.Cache.ImageCache.ClearCache(true);Gecko.Cache.ImageCache.ClearCache(false);//默认为所有设备(0)-https://bitbucket.org/geckofx/geckofx-9.0/issue/7/idl-translation-bug-for-enumsGecko.Cache.CacheService.Clear(newCacheStoragePolicy());本文收集自网络,不代表立场。如涉及侵权,请点击右侧联系管理员删除。如需转载请注明出处: