title: How To Upstate cookie value by name using JS ? cookie originally created from served side without . client side will give with . with Domain Name
body: <p>From JS client side call, 
  I am trying to update Cookie value that originally created from server Side. 
  Now I just noticed that Cookie is created originally with server side will be without . in Domain Name like "www.abc.com"</p>
  
  <p>But once i tried to update cookie by below code with same name from client side js call it creating 2 cookie with same name and different in Domain Name. 
  When we are trying to create cookie from client side its getting created with ".www.abc.com". </p>
  
  <p>I am using below code to update/create with same name : </p>
  
  <pre><code>if (days) {
      var date = new Date();
      date.setTime(date.getTime()+(days*24*60*60*1000));
      var expires = "; expires="+date.toGMTString();
      }
  else var expires = "";
  document.cookie = name+"="+value+expires+"; path=/; domain="+domainurl ;
  </code></pre>
  
  <p>How can i delete /update  that existing cookie without creating duplicate like below.<br>
  <a href="https://i.stack.imgur.com/6TOzp.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6TOzp.jpg" alt="enter image description here"></a></p>
  
  <p>Its creating Cookie but some different in domain name with or without <strong>"."</strong>
  How to resolved this problem, i have refer different <a href="https://stackoverflow.com/questions/10593013/delete-cookie-by-name">links</a>,<a href="https://stackoverflow.com/questions/2144386/javascript-delete-cookie">link2</a> but could not find the resolution. </p>
  
  <p>In simple work i need to update cookie value from client side same cookie originally created from server side used across java base Spring MVC application.</p>
  
  <p>Thanks in advance for any kind of help and info.  </p>