HTML5 Local Storage

Source: Internet
Author: User

The page's data will be reloaded after the page has been refreshed before HTML5. In server-side access we can store cookies to store some simple data.

Set cookies This section is described in http://www.w3school.com.cn/js/js_cookies.asp

<!DOCTYPE HTML><HTML><Head><MetaCharSet= "Utf-8"><title>Set cookies</title></Head><Body><Script>    functionSetcookie (c_name,value,expiredays)//cookie name, value, expiration time interval    {    varexdate=NewDate () exdate.setdate (Exdate.getdate ()+expiredays) Document.cookie=C_name+ "=" +Escape (value)+ //You can use Unescape () to decode an escape () encoded string. ((Expiredays==NULL) ? "" : "; expires="+exdate.togmtstring ())} Setcookie ("Wang","BA",Ten); </Script></Body></HTML>

In HTML5 , Sessionstorage and Localstorage are more powerful than cookies.

The cookie is placed under document

And the two are placed under the window.

Taking Localstorage as an example

1. Setting









HTML5 Local Storage

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.