开发者

How to store unlimited amount of cookies entries for all browsers

I created a browser solution that needs to store quite a bit of data into cookies. We talking about 1000+ entry poi开发者_如何转开发nts. Unfortunately most browsers have limitations if it comes to cookie saving (i.e. Firefox 3 Mac OS 10.6.6 = 150 parameter per domain).

I also store the data in a MySQL database after the user clicks on the save button that he really wants to keep those data persistent.

The reason I designed it this way is to have: A. a browser crash protection system in place, or the user closes the window/tab B. it is convenient for the user to come back to the same page and continue working on his project

Please let me know your thoughts or suggestions on that.

Many thanks!

PS: No ADS kiddie responses!


"How to store unlimited amount of cookies entries for all browsers?"

You can't.

Instead, you should use AJAX to periodically save the data the user has entered thus far into a "temporary" table in your database.

Stack Overflow actually has something similar to this when you write answers. You can start writing an answer, then refresh the page, and your answer will come back.


You can store a cookie, that tells you that the user has temporary data stored.

If the user's browser crashes, when they reopen the page, look for this cookie. If it's present and it has the correct value, then populate the form fields with the saved data when you are serving the page.

Let the user know that you've done this, and give them the option to start again if they wish to.


Another option for you could be to store the data in a LSO (Local Shared Object) using Adobe Flash:

By default, a Flash application may store up to 100kb of data to user's hard drive.

This will probably be enough space for you (if not, why are you trying to store my entire thesis client side?), provided that you can accept Flash as being a requirement to be able to restore form data.


The easiest solution I see for your problem is storing only one uniqueID / GUID in a persistent cookie which you will use as a key in your mysql database. Using this key you'll be easily able to shoot AJAX requests to a webservice for example which will manage your data directly in thhe database in the background. No data will be lost + it's transparent for the users.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜