Can I use a javascript function that converts string into bytes?

S

Shadab

Problem: I want to store data from a form into a cookie but the cookie
size is limited to 5kb. Eventually if the saved data crosses the limit
5 it does not get saved anymore. Is there any possibility to reduce
the size of the string so that I can save some more datas in a cookie?

I am doing a project where the usual requirement is to fill data
online (real time). In the event of no internet connection I still
want to fill the data and save in a form of a cookie (I am currently
not sure in what other format I should save the offline data). Once I
am connected to the internet it should be possible for me to
upload/integrate the offline data (which I currently save in the form
of cookie) to the online version/database.

Now the problem is if I fill the offline form the data is saved in a
form of a cookie, which has the limitations as pointed out earlier.
Subsequently the data does not get saved if I fill the 2nd form,
because the size of the first cookie is more or less 4kb!

What javascript function on clientside can I use that converts the
string into byte? Or, Is there a possibility to increase the cookie
size & how?

Thanks in anticipation.
 
H

Harald Hein

Shadab said:
I am doing a project where the usual requirement is to fill data
online (real time).

They let someone do a project who can't distinguish between Java and
JavaScript?
 
S

Sudsy

Shadab wrote:
I am doing a project where the usual requirement is to fill data
online (real time). In the event of no internet connection I still
want to fill the data and save in a form of a cookie (I am currently
not sure in what other format I should save the offline data). Once I
am connected to the internet it should be possible for me to
upload/integrate the offline data (which I currently save in the form
of cookie) to the online version/database.
<snip>

Considering that cookies are set by the SERVER, lack of Internet
connectivity kind of eliminates this possibility, don't you think?
I suggest a lot more research, including the differences between
Java and JavaScript.
 
C

charly

Shadab said:
Problem: I want to store data from a form into a cookie but the cookie
size is limited to 5kb. Eventually if the saved data crosses the limit
5 it does not get saved anymore. Is there any possibility to reduce
the size of the string so that I can save some more datas in a cookie?

I am doing a project where the usual requirement is to fill data
online (real time). In the event of no internet connection I still
want to fill the data and save in a form of a cookie (I am currently
not sure in what other format I should save the offline data). Once I
am connected to the internet it should be possible for me to
upload/integrate the offline data (which I currently save in the form
of cookie) to the online version/database.

Now the problem is if I fill the offline form the data is saved in a
form of a cookie, which has the limitations as pointed out earlier.
Subsequently the data does not get saved if I fill the 2nd form,
because the size of the first cookie is more or less 4kb!

What javascript function on clientside can I use that converts the
string into byte? Or, Is there a possibility to increase the cookie
size & how?

Thanks in anticipation.

Cookie are limited -> That's it because it's not YOUR hard drive, and
this limit is reasonable : cookies are not files :)

If you want to save data offline then use another language that can
write on the machine and upload the file on the server where it can be
parsed and stored on line.

Javascript as noted above is NOT Java.

What the point to convert byte into strings ? : you can't write more
than 5 *1024 characters in your cookie

Rethink your architecture, because cookies are not meant to be used this
way (IMHO).


Hope this helps :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,795
Messages
2,569,644
Members
45,358
Latest member
TreyTritt8

Latest Threads

Top