Precautions and usage of H5 storage: h5storage
Before using H5 storage, let's take a look at the introduction of storage:
The Storage module manages the local data Storage of applications for storing and reading application data. The difference between localStorage and sessionStorage is that the effective domains of data are different. The former can be used for cross-origin operations within applications, the data storage period is persistent and there is no capacity limit. storage can obtain local data management objects of applications.
Here we will talk about the two most common methods:
GetItem (key); -- obtains the value stored in the application based on the key value. If no value is returned, null is returned.
SetItem (key, value); -- save the data to application storage. If no value is returned, null is returned.
<Html>
The above is a very simple small column, so we will talk about some problems that we will encounter during use:
1: document. addEventListener ("plusready", plusReady, false); Do not add a listener every time you use this sentence. You only need to write it during initialization (only for a single page)
2: Some friends found that Ready was already used. Why did they still report the error: plus is .... don't worry. In fact, this problem is very simple. When your compiler runs on a real machine, you save it once locally and refresh the app once. This problem occurs, shut down the real machine and run it again.
In fact, this is very simple. Of course you know something about it. Here is an official document link for everyone. You can also perform practical operations based on the official content.
Http://www.html5plus.org/doc/zh_cn/storage.html