What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-10-10 05:49:03
save object in localstorage shows [object Object]
Looking at the Apple, Mozilla and Mozilla again documentation, the functionality seems to be limited to handle only string key/value pairs. A workaround can be to stringify your object before storing it, and later parse it when you retrieve it: var test... Add solution -
Html 2021-10-08 21:57:06
html cookies popup
<div class=’cookie-banner’ style=’display: none’> <p> By using our website, you agree to our <a href=’insert-link’>cookie policy</a> </p> <button class=’close’>... Add solution -
Other 2021-10-07 17:46:07
localstorage set item
var testObject = { 'one': 1, 'two': 2, 'three': 3 }; // Put the object into storage localStorage.setItem('testObject', JSON.stringify(testObject)); // Retrieve the object from storage var retrievedObject = localStorage.getItem('testObject'); console.lo... Add solution -
Javascript 2021-10-06 18:28:04
js save and load an array of different types into localstorage
var myArray = [1,"word",23,-12,"string"];//your list of values, they can be strings or numbers //SAVING function save(a,b,c,d,e) {//the number of parameters you add is how many items you save var itemArray = [a,b,c,d,e];//number of... Add solution -
Javascript 2021-10-03 03:31:05
session storage
// Save data to sessionStorage sessionStorage.setItem('key', 'value'); // Get saved data from sessionStorage let data = sessionStorage.getItem('key'); // Remove saved data from sessionStorage sessionStorage.removeItem('key'); // Remove all saved data f... Add solution -
Javascript 2021-10-01 10:17:04
store data in browser javascript
// localStorage for objects, arrays or any data type var obj = { firstName: "Bob", lastName: "Jeff", age: 13 } localStorage.setItem("itemname", JSON.stringify(obj)); // Save the obj as string var item = JSON.parse(lo... Add solution -
Go 2021-09-29 09:40:02
how to go back to the same page in data table after refreshing
$(document).ready(function() { $('#example').dataTable( { "bStateSave": true, "fnStateSave": function (oSettings, oData) { localStorage.setItem( 'DataTables', JSON.stringify(oData) ); }, ... Add solution -
Javascript 2021-09-24 16:59:04
how to send data in a url from one js to another
//first js page var favoritemovie = "Shrek"; sessionStorage.setItem("favoriteMovie", favoritemovie); //second js page var favoritemovie = sessionStorage.getItem("favoriteMovie"); console.log(favoritemovie); Add solution
Best helpers
Ranking is empty