title: Javascript Function Works on Local Server but not Online
body: <p>So I have this <code>javascript</code> game that works on my local server but once I put it online, one of the functions stops working. It may have something to do with permissions of the cookies I am storing for the high score. Can someone please point out what may be wrong.</p>
  
  <pre><code>    //Save Highscore if score is greater
   function saveScore() {
       loadScore();
       if (score &gt; highscore) {
           var date = new Date();
           date.setMonth(date.getMonth() + 5);
           var expires = "; expires=" + date.toGMTString();
           document.cookie = "score=" + score + expires + "; path=/";
       }
   }
  
   //Load High Score
   function loadScore() {
       var cookiearray = document.cookie.split(';');
       for (var i = 0; i &lt; cookiearray.length; i++) {
           var name = cookiearray[i].split('=')[0];
           var value = cookiearray[i].split('=')[1];
           if (name == "score") {
               //alert("Score Found!");
               highscore = value;
           }
       }
       return highscore;
   }
  
   //Lost game function
   function Lost() {
       saveScore();
       loadScore();
       var lost = document.getElementById("lost");
       var hs = document.getElementById("hs");
       lost.style.visibility = "visible";
       postscore.innerHTML = score;
       hs.innerHTML = highscore;
       lost.addEventListener('click', function (event) {
           window.location.reload();
       });
   }
  </code></pre>