• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 874
  • Last Modified:

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
0
yarek
Asked:
yarek
1 Solution
 
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

Featured Post

Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now