Home > Web Front-end > H5 Tutorial > LocalStorage and sessionStorage of HTML5 Web storage methods for data local storage case application_html5 tutorial skills

LocalStorage and sessionStorage of HTML5 Web storage methods for data local storage case application_html5 tutorial skills

WBOY
Release: 2016-05-16 15:50:53
Original
1615 people have browsed it

Use the localStorage and sessionStorage methods of HTML5 Web storage for local storage of Web page data.

The page reference is as shown below, and the data on the page can be stored locally. And can read the stored data and display it on the page.

LocalStorage (local storage) can store data for a long time. There is no time limit. The data can be used in one day, one year, two years or even longer.

sessionStorage (session storage) is only used before the browser is closed. It can be used when creating another page. The data will disappear after closing the browser.

A blogger’s test localStorage compatibility is as follows:
Chrome 4 starts to support localStorage

Firefox 3.5 starts to support localStorage
Firefox1.5 supports globalStorage

IE8 supports localStorage
IE7 compatibility mode supports localStorage
IE5.5 supports userdata

Safari 4 supports localStorage
Opera10.5 supports localStorage



Copy code
The code is as follows:



















< ;input type="button" class="button" onclick="cleanStorage()" value="local clear" />



Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template