本文介绍了壁虎清除缓存历史&饼干的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

帮助!我使用 GeckoFx-Windows-10.0-0.6 浏览器和 xulrunner-10.0.en-US.win32 。 (Visual Studio 2010 c#)一切运行良好。但我需要清除所有的历史,在Firefox:
工具>>选项>>隐私



我发现如何清除cookie超过 Gecko .CookieManager.RemoveAll();



如何清除缓存,临时文件和历史记录?



当我初始化 Gecko.Xpcom 我无法清除文件夹Gecko.Xpcom.ProfileDirectory (其中缓存和cookie)由于显而易见的原因。
Gecko.Xpcom.Shutdown()不起作用






我发现通过javascript清除Cookie的方法:



var cookieManager = Components.classes [@ mozilla.org/cookiemanager; 1]。getService(Components.interfa ces.nsICookieManager);
cookieManager.removeAll();



在C#中如何调用这个JS?

  if(MessageBox.Show(Do you want to delete cookies?,About to delete all cookies,MessageBoxButtons.YesNo,MessageBoxIcon.Information)== DialogResult.Yes)
{
nsICookieManager CookieMan ;
CookieMan = Xpcom.GetService< nsICookieManager>(@ mozilla.org/cookiemanager;1);
CookieMan = Xpcom.QueryInterface< nsICookieManager>(CookieMan);
CookieMan.RemoveAll();
}

在运行期间访问缓存时被拒绝安全等原因。
含义你需要在程序关闭后找到一个删除这些文件夹的方法。
创建另一个应用程序来处理它。


Help! I use GeckoFx-Windows-10.0-0.6 for browser and xulrunner-10.0.en-US.win32. ( Visual Studio 2010 c# ) everything works well. But i need to clear all history as at Firefox : Tools >> Options >> Privacy

I find how clear cookie over Gecko.CookieManager.RemoveAll();

How clear cache , temp files and history ?!

And when i initialize Gecko.Xpcom i can not clean the folder "Gecko.Xpcom.ProfileDirectory" (where cache and cookie) for obvious reasons.Gecko.Xpcom.Shutdown() does not help


I found a way to clean the cookies via javascript :

var cookieManager = Components.classes["@mozilla.org/cookiemanager;1"].getService(Components.interfa‌​ces.nsICookieManager);cookieManager.removeAll();

How right call this JS in C#?

解决方案

To clear cookies you will need to query interface like this:

    if (MessageBox.Show("Do you want to delete cookies?", "About to delete all cookies", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
    {
        nsICookieManager CookieMan;
        CookieMan = Xpcom.GetService<nsICookieManager>("@mozilla.org/cookiemanager;1");
        CookieMan = Xpcom.QueryInterface<nsICookieManager>(CookieMan);
        CookieMan.RemoveAll();
    }

An access to cache is denied during runtime brobably cause of security or such.Meaning you will need to find a way to delete these folders after you program closes etc.create another app for handling it.

这篇关于壁虎清除缓存历史&amp;饼干的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-12 06:09