title: Session and Cookies in Javascript are not Stored (not Working)
body: <p>I'm learning sessions and cookies in JavaScript. I have a form that takes some data and store it in session and cookies variables to be displayed in another page (second page) as follows: </p>
  
  <pre><code>&lt;html&gt; 
  &lt;body&gt; 
  &lt;form action="second.html" onsubmit="return myFunction();"&gt; 
  Enter a session variable: &lt;input id="sess" type="text" /&gt;
  &lt;/br&gt; 
  Enter a coockie variable: &lt;input id="cookiess" type="text" /&gt; 
  
  &lt;/br&gt; 
  &lt;input type="submit" /&gt;
  &lt;/form&gt; 
  
  &lt;script&gt; 
  function myFunction() {
  document.cookie = "username="+document.getElementById("cookiess").value + "; expires=Fri, 14 Oct 2016 12:00:00 UTC";
  sessionStorage["myKey"] = document.getElementById("sess").value;
  
  return true;
  } 
  
  &lt;/script&gt;
  &lt;/body&gt; 
  &lt;/html&gt; 
  </code></pre>
  
  <p>and this is the second.html page: </p>
  
  <pre><code>&lt;html&gt; 
  &lt;body&gt; 
  
  &lt;script&gt; 
  
  alert(sessionStorage["myKey"] + document.cookie); 
  &lt;/script&gt;
  &lt;/body&gt; 
  &lt;/html&gt; 
  </code></pre>
  
  <p>However, when I display the session and cookie variables in the alert function, it display empty variables. Why my session and cookies variables don't work? </p>