Career development, code 100 days--2018-05-18
Today's main learning content is JavaScript in the browser object--cookie.
Cookies are used to store user information for Web pages, and their storage capacity is small, typically several k or so. The preservation of user information in common Web pages is basically achieved by using cookies.
Cookies are simple to use and store information in the form of key-value pairs, such as
Username=allen
When the user accesses the page, the user information is saved in the cookie, the next time the user visits the page, the user directly from the cookie to obtain information and fill in the user Information Bar, to avoid the user to repeat the steps of input.
Characteristics of Cookies:
- Share a cookie on all pages of the same website;
- Cookie capacity is very small;
- You can add an expiration time for a cookie.
Here's how to create, read, and delete cookies.
1. Creation of cookies
JS, the invocation of the cookie: Document.cookie
Day63-javascript Browser Object Cookie