Precautions and usage of H5 storage: h5storage

Source: Internet
Author: User

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

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.