views:

67

answers:

2

hi everyone. i've got a problem: i need my extension for firefox 3.5+ to delete cookies. all cookies of my firefox. example: i've serfed net, got some cookies installed on my pc by the sites i've visited. and i want my extension for ff to delete all these cookies. could u please show me the direction where i can find an answer for my question? (or and it'll be the best, give a link to a code sample) and one more: can i do this in javascript or i must use c/c++ and napi?

p.s.\i do not need an extension like close'forget, i want my own extension been able to do this work. thanx for u'r future answers and sorry for my bad english...got no speach practice for a long time=(

+2  A: 

From https://developer.mozilla.org/en/Code%5Fsnippets/Cookies , you just need to do the following in privileged javascript (i.e., inside a Firefox extension):

Components.classes["@mozilla.org/cookiemanager;1"]
      .getService(Components.interfaces.nsICookieManager).removeAll();

If you want to do this without writing an extension, just go to options (Tools->Options on Windows, Edit->Preferences on Linux, Firefox->Preferences on Mac) and see the "Privacy" tab.

sargas
Sorry, I can't add comments to other posts (just joined today), so I'll just answer your question here: It's been frozen since gecko 1.9 according to https://developer.mozilla.org/en/nsICookieManager . Mozilla has a listing at https://developer.mozilla.org/en/gecko which shows what is using what version, so it looks like all the latest products from Mozilla are there.It may still work in older versions (the source log looks like removeAll has been there since at least 2007), but just always test these things. For other gecko browsers it likely just depends on the version of Gecko they have.
sargas
A: 

thanx man. i've asked this question and started to study some plugins that performe the same function. but the link u've provided hes been extremly usefull! been on their site i couldn't find this page..once again thanx man!

while i've been writing this post i've got one more question: will this code work in all browsers those use Gecko? mean is it an cross-broweser solution?

zihash
Hi and welcome to SO. Please note that this is not a forum and any responses to answers should be made as comments to that answer.
Justin Johnson