title: How to detect if browser supports HTML5 Local Storage
body: <p>The following code alerts <code>ls exist</code> in IE7:</p>
  
  <pre><code>if(window.localStorage) {
      alert('ls exists');
  } else {
      alert('ls does not exist');
  }
  </code></pre>
  
  <p>IE7 doesn't really support local storage but this still alerts it does. Perhaps this is because I am using IE9 in IE7 browser and document modes using the IE9 developer tool. Or maybe this is just the wrong way to test if LS is supported. What is the right way?</p>
  
  <p>Also I don't want to use Modernizr since I am using only a few HTML5 features and loading a large script isn't worth it just to detect support for those few things.</p>