title: How do I delete a cookie from a specific domain using Javascript?
body: <p>Let's say I am at <a href="http://www.example.com" rel="noreferrer">http://www.example.com</a> and I want to delete a cookie whose domain is <strong>.example.com</strong> and another one whose domain is <strong>www.example.com</strong>.</p>
  
  <p>I am currently using this generic function :</p>
  
  <pre><code>var deleteCookie = function (name)
  {
    document.cookie = name + '=; path=/; expires=Thu, 01 Jan 1970 00:00:01 GMT;';
  };
  </code></pre>
  
  <p>which only seems to be removing cookies whose domain is <strong>www.example.com</strong>. </p>
  
  <p>But how can I specify so that it also removes cookies whose domain is <strong>.example.com</strong> ?</p>
  
  <p><strong>EDIT :</strong> Basically I'm looking for a function that can delete all cookies related to <a href="http://www.example.com" rel="noreferrer">http://www.example.com</a> as long as they don't have the httponly flag. Is there such a function?</p>