H5 local storage and H5 Storage

Source: Internet
Author: User

H5 local storage and H5 Storage

They can store: array json data image script style files;

The client stores two:

1. localStorage data storage with no time limit ()

Methods include:. localStrage. getItem (); localStrage. setItem (); removeItem (); localStrage. key () starts from 0;. localStrage, clear ();

To store an image, you must use a canvas with the same size as the image and render it to the canvas. Use the toDateURL () method of the canvas to store the image locally. Use try () catch (e) {}. Obtain and render the cached data locally.

Note:. Before use, make sure that the browser supports,

B. When writing data, you need to handle exceptions to avoid errors when the capacity is exceeded.

C. Avoid storing sensitive information in localStrage

D. Key uniqueness

Restrictions:. Storage update policy and expiration Control

B. Sub-domain names cannot share stored data

C. How can I store data after the storage size is exceeded,

D. How to obtain the server ()

2. sessionStorage session-based Data Storage

 

The rest can follow this address: http://www.cnblogs.com/xiaowei0705/archive/2011/04/19/2021372.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.