In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces how to use web local storage in html5, which has a certain reference value. Interested friends can refer to it. I hope you can learn a lot after reading this article.
Html5 provides us with a local caching mechanism that will replace our cookie, and it will not be sent to our server side with the browser. We can use js to operate the local cache freely on the client side. The main caches in html5 are localStorage, and sessionStorage. Their usage is the same. The difference is that they have different time limits. There is no time limit for localStorage. SessionStorage is now based on session data storage, after shutting down or leaving the site, the data will be deleted.
Let's take a brief look at the official example operation:
Javascript
The code is as follows:
LocalStorage.fresh = "vfresh.org"; / / set a key value
Var a = localStorage.fresh; / / get the key value
Or use its API:
Javascript
The code is as follows:
/ / clear storage
LocalStorage.clear ()
/ / set a key value
LocalStorage.setItem ("fresh", "vfresh.org")
/ / get a key value
LocalStorage.getItem ("fresh")
/ / return "vfresh.org" / / gets the name of the key of the specified subscript (like Array)
LocalStorage.key (0)
/ / return "fresh" / / Delete a key value
LocalStorage.removeItem ("fresh")
If sessionStorage is the same, there is no need to talk nonsense. It is the cookie of our expiration time Expire=0.
Thank you for reading this article carefully. I hope the article "how to use web Local Storage in html5" shared by the editor will be helpful to everyone. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.