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