Page 1 of 1

Compress a string in JavaScript using GZIP?

Posted: Wed Jun 11, 2008 12:58 pm
by JAB Creations
I'm interested in checking the length of form data being submitted. It will be stored as a GZIP compressed string in a cookie. However to help reduce bandwidth/server load I'd like to (if possible) compress the string with JavaScript. I know you can obviously test the length of a string...it's the compression part I'm not sure of. I need to ensure via JavaScript that the string is not longer then 4085 characters in length after compression which is the absolute maximum amount of data that can be accepted.