writing and reading BIG size COOKIES (>4Kbytes) in JAVASCRIPT

I need to store a BIG size information on a cookie (more than 30Kbytes!)
I know the limit size is 4K, so I need to decompose it into pieces of 4K

sample of a NOT WORKING script for large size cokies !

function save_cookie() {
      var Objhtml = document.getElementsByTagName('HTML');
      source=Objhtml[0].innerHTML;// source  size = 40Kbytes !
                     alert(source);
      writeCookie('source',source); // this does not work since size >4Kb
      
}
function load_cookie() {
      source=readCookie('source');
                     document.getElementsByTagName('HTML').innerHTML=source;
      alert(source); // this is NULL !
      
}

I need a script to write BIG cookies (crunched into 4Kbytes): ANY SOURCE for that
yarekAsked:
Who is Participating?
 
BadotzCommented:
Perhaps it is time for a rethink - why not save to a Session or Application object? Or a database, for that matter. AJAX makes any of those options almost trivial.
0
 
Pravin AsarPrincipal Systems EngineerCommented:
You have options

1. DO Session Management at Server

2. Split the cookie data in multiple cookies. You can save upto 20 cookies , each 4KB

   
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.