• HTML5 Local Storage

    abemassry        
    0 Likes0 Commentsjavascript

    function supports_html5_storage() {
      try {
        localStorage["works"] = "yes";
        return 'localStorage' in window && window['localStorage'] !== null;
      } catch (e) {
        return false;
      }
    }
    
    $(document).ready(function() {
      $("#login_button_pressed").click(function(){
        if (supports_html5_storage() !== false) {
          localStorage["code_stored"] = 1;
          localStorage["title"] = $("#title").val();
          localStorage["lang"] = $("#lang").val();
          localStorage["filter"] = $("#filter").val();
          localStorage["code"] = editor.getValue();
        }
        $("#code_holder").val(editor.getValue());
      });
    });

Comments (0)