title: Javascript - cookie cleared after browser is closed?
body: <p>I'm trying to set cookie that would last after browser is closed. Though every-time I close browser, cookie disappears. I thought cookies supposed to be kept even if browser is closed? Unless specified to be deleted after some time?</p>
  
  <p>For example:</p>
  
  <pre><code>console.log("cookies ", document.cookie)
  document.cookie = "some_cookie=true; max-age=31536000";
  </code></pre>
  
  <p>First time opening page with this JS code, it prints <code>cookies</code>. </p>
  
  <p>After refreshing browser, it prints <code>cookies some_cookie=true</code></p>
  
  <p>After closing browser and opening same page again, it prints <code>cookies</code>.</p>
  
  <p>I tested on <code>Firefox 65.0.2 (64-bit), Chrome 72.0.3626.109 (Official Build) (64-bit) and Chromium 71.0.3578.98 (Official Build) Built on Ubuntu , running on Ubuntu 16.04 (64-bit)</code> (for Chrome and Chromium had to use http server, because it would not allow to set cookies at all, if raw html file was opened directly). </p>
  
  <p>Results are all the same, after I close browser, my cookie is deleted. I also checked if there was an option to clear cookies on closing browser, but it is not enabled.</p>
  
  <p>Am I doing something wrong here? Or cookies are outdated and I should just stick to <code>localStorage</code>?</p>
  
  <p>P.S. I tried using <code>max-age</code>, <code>expires</code> or not using those at all, but result is the same.</p>