title: Using localstorage in bookmarks
body: <p>I quite like using bookmarks with small scripts in them.</p>
  
  <p>For example, I have edited the note editing script from <a href="http://www.reddit.com/r/LifeProTips/comments/265rxe/lpt_use_a_browser_tab_as_a_quick_and_simple/" rel="nofollow">this post</a> on Reddit to automatically save and load the last note via localstorage.</p>
  
  <pre><code>...
  
  window.addEventListener("load", function () {
      div.innerHTML = localStorage.getItem("note");
  }, false);
  document.body.addEventListener("keyup", debounce(function () {
       localStorage.setItem("note", div.innerHTML);
  }, 760));
  ...
  </code></pre>
  
  <p>It runs fine if I open my html document as an actual html document stored on my hard drive. But when I run it using the URL bar pasting in the (minified) version of my code with <code>data: text/html, ...</code>, I get a <code>NS_ERROR_NOT_AVAILABLE:</code> error. This makes sense, since localstorage is domain-bound.</p>
  
  <p>Is there a way to make localstorage work with bookmarks?</p>
  
  <p><a href="https://gist.github.com/Azeirah/6759ee635df3b113b0c1" rel="nofollow">The full note code is available here</a>, note that this code <em>will</em> work if you save it locally on your hard-drive. So you can bookmark this and use it if you want to.</p>