Link to home
Start Free TrialLog in
Avatar of yarek
yarekFlag for France

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of Badotz
Badotz
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Pravin Asar
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