Home >Web Front-end >JS Tutorial >Use js to read, write and delete cookie code continuation_javascript skills
Last article: Using js to read, write, and delete cookie code sharing and detailed comments , some problems were discovered in practice:
1. Cookies on local files can only be debugged on Firefox, and are invalid for IE and chrome
2. The cookie is not set to never expire. It is only considered to set a time period before it expires, which is obviously unreasonable.
This time we give a more reasonable cookie operation code:
The example demonstrates: click on the text to expand the content, and click again to hide it. When the content is hidden, it will still be hidden next time it is opened. When the content is displayed, it will still be displayed next time it is opened.
After expansion, you can see the content here