Exception
Exception

Reputation: 8379

Other Alternatives to Cookies

I am using cookies to store data at client end for later access. But my concern is I am unable to set more than 20 cookies and I am looking for alternative to cookies.
Please help me on this

 Updated

I found jStorage plugin here But it does not work for me in this case..

Upvotes: 7

Views: 13446

Answers (5)

Pavan
Pavan

Reputation: 4329

You can leverage local/session storage of HTML5

To save a value:

localStorage.name = "Bob";

To get a value:

alert(localStorage.name);

http://www.w3.org/TR/webstorage/

Upvotes: 10

Sandeep G B
Sandeep G B

Reputation: 4015

There are few alternatives to cookies

  1. Session (server side)

  2. If HTML5 compliant browser then you can even have client side database

Upvotes: 1

Dave Child
Dave Child

Reputation: 7881

Are you storing one piece of information in each cookie? Because you could use JSON serialization to store more data in each individual cookie.

Upvotes: 2

Quentin
Quentin

Reputation: 943209

The two main options are Web Storage and Web SQL Database.

Upvotes: 3

lorenzo-s
lorenzo-s

Reputation: 17010

You can store only one cookie representing a session ID (for example, an alfanumeric randomly generated long string). Then you just need a database to store all your data (that now is on 20 cookies) together with that session ID. At runtime, you read from the only cookie the session ID, and load from the DB all data.

Upvotes: -3

Related Questions