0

我需要保存表单状态(输入元素的值)。

但表单不是标准的 html 表单,因此浏览器不会保存表单状态。

我需要将表单状态存储为 cookie 我无法在服务器端保存任何内容。

但 cookie 的大小约为 10 KB。这个怎么做?有人有想法吗?

4

1 回答 1

1

Split the 10KB of data into multiple cookies (i.e. cookies with different names in the same domain) when saving and combine those cookie values when retrieving.

If I recall correctly, the standard size of a cookie in most modern browsers is ~4096 bytes (sometimes including the name, sometimes not) so bear this in mind when creating the cookies.

Also bear in mind that the data in the cookies could be tampered with so exercise due diligence when working with such data.

于 2012-01-16T12:57:46.457 回答