The new HTML5 API

6.1 Characteristics

1, set up, easy to read, refresh the page without losing data

2, larger capacity, the sessionStorage about 5M, localStorage about 20M

4, can store the string, the object may be the JSON.stringify () stores coded

6.2 window.sessionStorage

1, the life cycle of closing the browser window

2, in the same window (page) data can be shared

6.3 window.localStorage

1, permanent, unless there will manually remove Close

2, can be multi-window (page) share (the same browser can be shared)

6.4 Detailed method

setItem (key, value) set the stored content

getItem (key) to read the stored content

removeItem (key) delete the key is to store content key

clear () to clear all memory contents

Guess you like

Origin www.cnblogs.com/zeroDoctor/p/12299916.html