JohnRoach
JohnRoach

Reputation: 757

How to save large amount of data within users browser?

I have been writing a php script that saves a long string within cookie (more than 4000 chars long) and I want to save it within the browser cache. The problem is that almost all browsers have a limit. What should I do? I'm using jQuery for adding and reading data from cookie and php.

Upvotes: 3

Views: 5712

Answers (7)

Jhanvi
Jhanvi

Reputation: 592

You can use HTML5 based concept of IndexDb to save data at client end.

www.tipstr.in/html5-learn-use-indexeddb

Upvotes: 2

Geomorillo
Geomorillo

Reputation: 1015

Use http://www.jstorage.info/ this will help you store lots of data without problems

Upvotes: 1

ovais.tariq
ovais.tariq

Reputation: 2625

You can use jQuery data method to store data:

http://api.jquery.com/jQuery.data/

jQuery itself uses this method to store information.

But this will not persist the data.

Why not store the information in a hidden field in the form? But that again is going to remain stored only until the browser is not closed.

Upvotes: 0

Svisstack
Svisstack

Reputation: 16636

  1. You can split data into more smaller cookies (you can name it in some defined continuous like abcd_0, abcd_1).
  2. You can save string at server side (in database or server filesystem) and save in cookie only MD5 checksum of this string, and when you want read this string you must transport cookie value (MD5 checksum) at server side and do query in the database or search in filesystem to obitan data and transport to browser.

Upvotes: 0

Paul Annesley
Paul Annesley

Reputation: 3397

Check out Web Storage Portability Layer: A Common API for Web Storage

It abstracts the various local storage mechanisms that browsers provide.

Local storage is becoming standardized in HTML5.

Upvotes: 1

Frankie
Frankie

Reputation: 25165

Rethink your App logic and save most of the data on server.

This will save you a lot of hassle in the long run.

Just my two cents.

Upvotes: 4

Zoidberg
Zoidberg

Reputation: 10333

I know your looking for a JQuery solution, but perhaps this will give you a starting point to look for a JQuery option. Its html 5 data storage on the client side. 10 megs in IE, and 5 megs in all other browsers. I believe yahoo has a solution in theirs for non-HTML 5 browsers.

http://developer.yahoo.com/yui/storage/

Upvotes: 0

Related Questions