title: Delete specific cookie in chrome extension when the icon clicked
body: <p>this is my first program and i'm getting lost..
  I try to do an extension that delete one cookie from specific web when I click on the icon of this extension.
  What's wrong with my code?</p>
  
  <p>Thank you all!</p>
  
  <p>manifest.json:</p>
  
  <pre><code>    {    
    "name" : "Delete Cookie",
    "version" : "0.8",
    "manifest_version": 2
    "description" : "Delete Cookie by icon clicked",
    "permissions": [ "cookies", "http://www.example.com" ],
    "icons": { "16": "cookie.png", "48": "cookie.png", "128": "cookie.png" },
    "browser_action": {
    "default_icon": "cookie.png"
    },
    "background": {
    "scripts": ["background.js"]
    },
  
  }
  </code></pre>
  
  <p>backgroung.js:</p>
  
  <pre><code>chrome.browserAction.onClicked.addListener(DeletCookie) 
  function DeletCookie()  
  {  
        chrome.cookies.remove({url:"http://www.example.com", name: "CookieName"})  
  }  
  </code></pre>
  
  <h1>EDIT</h1>
  
  <p>I tried this:</p>
  
  <pre><code>chrome.cookies.getAll({domain: "www.example.com"}, function(cookies) {
  for(var i=0; i&lt;cookies.length;i++) {
    console.log(cookies[i]);
  
    chrome.cookies.remove({url: "https://" + cookies[i].domain  + cookies[i].path, name: cookies[i].name});
  }
  </code></pre>
  
  <p>});</p>
  
  <p>and it worked,but this way it delete the cookie every time it shwoes up.</p>
  
  <p>So I try:</p>
  
  <pre><code>function DeleteCookie (){
     chrome.cookies.getAll({domain: "www.example.com"}, function(cookies) {
         for(var i=0; i&lt;cookies.length;i++) {
          console.log(cookies[i]);
  
          chrome.cookies.remove({url: "https://" + cookies[i].domain  +           cookies[i].path, name: cookies[i].name});
         }
      });   
  }; 
  chrome.browserAction.onClicked.addListener(DeletCookie) ;
  </code></pre>
  
  <p>and this way it doesn't work again</p>