title: localStorage not working as expected. Not saving when page is redirected
body: <p>localStorage not saving variables when new page loads.</p>
  
  <p>I've tried using variables, objects, and now localStorage to save data from one .js file to another. In javascript I use windows.location to change the page and all variable data is reset. All variables are global in scope. </p>
  
  <p>// IN SEPERATE .JS FILE</p>
  
  <pre><code>var beganStory = false;
  localStorage.setItem("beganStory", beganStory);
  var isMale = false;
  localStorage.setItem("isMale", isMale);
  </code></pre>
  
  <p>// IN ANOTHER .JS FILE</p>
  
  <pre><code>document.querySelector("#boy").addEventListener("click", ChangeToMale);
  document.querySelector("#boy").addEventListener("click", Redirect);
  
  document.querySelector("#girl").addEventListener("click", Redirect);
  
  function Redirect()
  {
      window.location = "StatsPicker.html";
  }
  
  function ChangeToMale()
  {
      console.log("Changed To Male!");
      alert(localStorage.getItem("isMale"));
      localStorage.setItem("isMale", true);
      alert(localStorage.getItem("isMale"));
  }
  </code></pre>
  
  <p>I expected the variable to be saved when the user clicks the element with id boy. The actual result is when the page is redirected the and I use the localStorage.getItem("isMale") it returns false.</p>