Shared objects compared with cookies

本文对比了Cookie与共享对象的特点,介绍了它们各自的属性,如有效期、大小限制、存储位置及传输方式等。对于熟悉Cookie的开发者来说,了解共享对象的工作原理及其与Cookie的区别将有助于更好地选择合适的数据存储方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Shared objects compared with cookies

Cookies and shared objects are very similar. Because most web programmers are familiar with how cookies work, it might be useful to compare cookies and local SharedObjects.

Cookies that adhere to the RFC 2109 standard generally have the following properties:

  • They can expire, and often do at the end of a session by default.
  • They can be disabled by the client on a site-specific basis.
  • There is a limit of 300 cookies total, and 20 cookies maximum per site.
  • They are usually limited to a size of 4 KB each.
  • They are sometimes perceived to be a security threat, and as a result, they are sometimes disabled on the client.
  • They are stored in a location specified by the client browser.
  • They are transmitted from client to server through HTTP.

In contrast, shared objects have the following properties:

  • They do not expire by default.
  • By default, they are limited to a size of 100 KB each.
  • They can store simple data types (such as String, Array, and Date).
  • They are stored in a location specified by the application (within the user's home directory).
  • They are never transmitted between the client and server.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值