title: Age verification with just javascript and no cookies: how?
body: <p>I'm building a website for a EU company that sells beer, and need an age verification splash screen. That's quite easy, and I have one in place already. I use a lightweight cookie plugin (<a href="https://github.com/js-coder/cookie.js" rel="nofollow">cookie.js</a> found on the excellent <a href="http://microjs.com" rel="nofollow">http://microjs.com</a>) in the page header. This is more or less my set up:</p>
  
  <p>JS (in <code>&lt;head&gt;</code> element)</p>
  
  <pre><code>if (cookie.get("agechecked")) {
      document.documentElement.className += " agechecked";
  }
  </code></pre>
  
  <p>CSS</p>
  
  <pre><code>.agechecker { display: block; width: 100%; height: 100%; ... } 
  .agechecked .agechecker { display: none };
  </code></pre>
  
  <p>Sadly, for few visitors the agecheck doesn't work properly. Some can't get past it, for others it pops up after every page load, and for some, cookies just don't work which means the checkbox 'remember me' is broken to them. I want to use an alternative route to at least make sure the agecheck doesn't prevent anyone from viewing the site completely.</p>
  
  <p>I only have javascript to my disposal and don't want to use cookies. Since I'm quite sure the equivalent to a session is a cookie that expires after the browser closes - so that kind of limits my options to... yeah, what?</p>
  
  <p>Alternatives I'm considering:</p>
  
  <ul>
  <li><a href="http://www.jstorage.info/" rel="nofollow">jStorage</a> - but that relies on a framework such as jQuery or Prototype, meaning I'd have to load jQuery in the page header. That won't do;</li>
  <li>The <code>window.name</code> method, combined with JSON to store data in the window <code>name</code> property, which is a bit too hacky for my taste, and also doesn't carry over to other tabs</li>
  <li>I could check the referer (was the visitor already on another page on this domain?) which is a 90% guarantee he/she got through the agecheck</li>
  </ul>
  
  <p>I couldn't find any real useful information here on stackoverflow, but I'm sure some of you have built age verifications. How did you solve these issues?</p>
  
  <p>(edit: I know, I should build a form that actually posts to the server where I can store and retrieve information in a gazillion different manners, but just take it from me I have to rely on javascript. Can't help it)</p>