abemassry
2 Likes 0 Comments javascriptfunction supports_html5_storage() {
try {
//if it worked then you can write something to local storage
localStorage["works"] = "yes";
return 'localStorage' in window && window['localStorage'] !== null;
} catch (e) {
return false;
}
}
$(document).ready(function() {
$("#login_button_pressed").click(function(){
//if not false then it means it worked
if (supports_html5_storage() !== false) {
//write key value pairs to local storage
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());
});
});
created with codestagram