title: Running function on first time page load
body: <p>I'm trying to run a spinner on the first time a user views the homepage on a website. I'm using <code>localStorage</code> to see if the user has visited the site before but I don't think it is running correctly.</p>
  
  <pre><code>function load() {
      var isFired = localStorage.getItem('checkFired');
      if (isFired != '1'){
      } else {
          $(".se-pre-con").fadeOut("fast");
          localStorage.setItem('checkFired', '1');
      }
  }
  
  $(window).load(function() {
    load();
  });
  </code></pre>
  
  <p>This only needs to run the first time the view the homepage. If they navigate away and come back I don't want the spinner to be displayed. Currently it runs everytime they view the homepage. If I put the below code in the <code>if</code> part of the <code>if</code> statement, the spinner continues to spin and the page never loads.</p>
  
  <pre><code>$(".se-pre-con").fadeOut("fast");
  localStorage.setItem('checkFired', '1');
  </code></pre>
  
  <p>Any ideas how I can get this working?</p>
  
  <p>EDIT: Css of spinner</p>
  
  <pre><code>.se-pre-con {
      position: fixed;
      left: 0px;
      top: 0px;
      width: 100%;
      height: 100%;
      z-index: 9999;
      background: url(../img/ring.gif) center no-repeat #fff;
      overflow-y: hidden;
  }
  </code></pre>