title: Cookie Redirect Script
body: <p>I am quite a noob concerning programming but learning. I have 3 pages, index.htm, ef.htm &amp; dh.htm. On e.g. linkedin I have a link to ef.htm and want, that if you have been to ef.htm, you will always be redirected to ef.htm, when entering index.htm or dh.htm. The same vice versa.
  I created/found following script:</p>
  
  <pre><code>&lt;script type="text/javascript" src="/js/jquery.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/js/cookie.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
  $(function() {
  var COOKIE_NAME = 'testcookie';
  $go = $.cookie(COOKIE_NAME);
  if ($go == null) {
      $.cookie(COOKIE_NAME, 'test', { path: '/', expires: 10 });
      window.location = "/dh.php"
  }
  else {
  }
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>The .js are added to my directory.
  How can I make that script work like I want to?
  I tried 500 different things, but no success. Is there even a more elegant method? ALl things I found on stackoverflow, where not exactly what I wanted or dont work.</p>
  
  <p>Thanks a lot for your help!</p>