简体   繁体   中英

Alternative for document.cookie in JavaScript

除了用于查看浏览器中所有cookie的“ document.cookie ”之外,是否还有其他JavaScript代码?

document.cookie is for getting/setting cookies - that's what you should use...

There is an alternative for local storage with javascript, which is conveniently called localStorage and sessionStorage .

If you're looking for a library to make it easier to work with document.cookie , perhaps you'd be interested in this: jQuery Cookie (click). Even better, MDN has a little library for working with cookies in these docs (click) (no need for jQuery).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM