The localStorage and sessionStorage attributes allow key/value pair data to be stored in the browser.
localStorage is used to save the data of the entire website for a long time. The saved data has no expiration time until it is manually deleted.
sessionStorage is used to temporarily save the data of the same window or tab, which will be deleted after the window or tab is closed
localStorage: local storage
It is used to save the data of the entire website for a long time. The saved data has no expiration time until it is manually deleted. The attribute is read-only. localStorage only supports string type storage. It should be noted here that the use of localStorage also follows the same-origin policy, so different websites cannot directly share the same localStorage.
Syntax:
window.localStorage
Save data< /strong>
localStorage.setItem(‘key’,’value’)
Read data
var lastname = localStorage.getItem(‘key’)
Remove data
localStorage.removeItem (‘key’)
sessionStorage local storage
sessionStorage is used to temporarily save the data of the same window (or tab), which will be deleted after the window or tab is closed
Prompt : If you want to keep the data after the browser window is closed, you can use the localStorage property. The data object has no expiration time, unless you delete it manually
Syntax: window.sessionStorage< /strong>
Save data
sessionStorage.setItem(‘key’,’value)
Read data:
sessionStorage.getitem(‘key’)
Delete the data of the specified key< /strong>
sessionStorage.removeItem(‘key’)
Remove all data
< strong>sessionStorage.clear()
WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 4263 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC