What do you want to save?
Add Code snippet
New code examples
-
Other 2021-10-24 09:19:13
retrieving from local storage and converting into class instance
// Create some Point instances let p1 = new Point(1,2); // Store them in local storage localStorage.setItem("p1", JSON.stringify(p1)); // Retrieve the data into new variables let p1Data = JSON.parse(localStorage.getItem("p1")); // c... Add solution -
Javascript 2021-10-24 07:24:06
carry forward session storage one page to another page in javascript
// transfers sessionStorage from one tab to another var sessionStorage_transfer = function(event) { if(!event) { event = window.event; } // ie suq if(!event.newValue) return; // do nothing if no value to work with if (event.key == 'getSessi... Add solution -
Javascript 2021-10-23 03:53:09
store and retrieve object from localstorage
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 -
Other 2021-10-18 16:34:13
store data to the browser’s localStorage
export const setToLS = (key, value) => { window.localStorage.setItem(key, JSON.stringify(value)); } export const getFromLS = key => { const value = window.localStorage.getItem(key); if (value) { return JSON.parse(value); } } Add solution -
Javascript 2021-10-16 22:02:03
vuejs localstorage add value
//You can just do following to save in localStorage localStorage.setItem('YourItem', response.data) // You can fetch this using: localStorage.getItem('YourItem') //To delete this from localStorage: localStorage.removeItem('YourItem') Add solution -
Javascript 2021-10-14 06:24:03
javascript store object in localstorage
var person = { "name": "billy", "age": 23}; localStorage.setItem('person', JSON.stringify(person)); //stringify object and store var retrievedPerson = JSON.parse(localStorage.getItem('person')); //retrieve the object Add solution -
Javascript 2021-10-12 23:31:03
refresh page and run function after javascript
window.onload = function() { var reloading = sessionStorage.getItem("reloading"); if (reloading) { sessionStorage.removeItem("reloading"); myFunction(); } } function reloadP() { sessionStorage.setItem(&... Add solution -
Javascript 2021-10-12 02:01:03
sessionStorage.setItem
// 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
Best helpers
Ranking is empty