title: Cookie is being set.But document.cookie is null
body: <p>I have set a cookie with <code>document.cookie</code>. The content settings in Google Chrome is showing the cookie. However, <code>document.cookie</code> is displaying as a blank string when printed. Why is this happening?</p>
  
  <p>Here is my code </p>
  
  <pre><code>function setCookie(name,value,lifeTime,path,domain,secure){//lifetime in hours
  {
           var c_ = name +'='+escape(value)+'; ';
  
              var life = new Date();
              lifeTime&lt;1&amp;&amp;lifeTime&gt;0?life.setMinutes(life.getMinutes()+lifeTime*60):life.setHours(life.getHours()+lifeTime);
              life = life.toUTCString();
              c_+='expires='+life+"; ";
  
  
  
  
          c_+= 'domain='+domain+'; ';
  
  
          c_ += 'secure=secure; ';//secure 
  
          c_ += 'path='+path;
  
          document.cookie = c_;
          alert(document.cookie);
  /*Just splitted the code instead of c = 'name='+value+'expires ='+life  etc*/
  
  }
  </code></pre>