We know that the size of the cookie that the browser itself can store is limited. If the maximum capacity is exceeded, cookies cannot be set anymore. How to ensure that the remaining capacity is sufficient during development? Assuming that a user visits a website and fills up its cookie, does it mean that subsequent websites visited cannot set cookies normally?
迷茫2017-06-12 09:32:41
The length of the string is document.cookie.length, and then the byte conversion is done
仅有的幸福2017-06-12 09:32:41
The capacity of cookie is 4K.
You can use localstorage instead of cookies.
The corresponding one is sessionstorage.
習慣沉默2017-06-12 09:32:41
The cookie is only 4k. If you want to save it, it is recommended to use localstorage. In addition, if you want to simulate the cookie time clearing, you can simply use the cookie to save a time to judge the storage time of localstorage, and it will be cleared at that time