save all variables in a cookie when the user leaves the page

W

windandwaves

Hi Folk

On one of my sites, I have a reather involved page (searchable map).
When the person leaves the page then all the AJAX generated
information is lost. Is there a way that I can retain all this data
in a cookie or so or how would you recommend I saved all the users
information (perhaps using a database on the serverside).

Any recommendations greatly appreciated.

Ta

Nicolaas
 
U

Une Bévue

windandwaves said:
Any recommendations greatly appreciated.

i think the best would be using json.js (see json.org) :

u serialize your datas and put them in a cookie as a string.

beware the size of a cookie is limited (don't remember how).

here i do have a first test of such kind of storing datas in a cookie :

<http://www.yvon-thoraval.com/Cookies/cookie_object_json.xhtml>

with four data values :

- pure string ;
- an array with an object as a value ;
- a pure object ;
- an object with an array as a value.

This is work on progress because i've discovered json 2 days ago )))

As far as i understand well, json will be included in a future version
of JavaScript ;-)
 
A

ASM

windandwaves a écrit :
Hi Folk

On one of my sites, I have a reather involved page (searchable map).
When the person leaves the page then all the AJAX generated
information is lost.

Isn't it user's problem ?
Next time he'l visit this page he'l have to run back all he has done
(probably his browser will remember what was in text-fields ?)
Is there a way that I can retain all this data
in a cookie or so or how would you recommend I saved all the users
information (perhaps using a database on the serverside).

<body onunload="document.myForm.submit()">
or
<body onbeforeunload="document.myForm.submit()">

those will fire as soon as :
- you quit the browser
or
- you close the window
or
- you call a new file in same window <-- important
 
R

Randy Webb

ASM said the following on 2/26/2007 4:50 AM:

<body onunload="document.myForm.submit()">
or
<body onbeforeunload="document.myForm.submit()">

those will fire as soon as :

You hope they fire.
- you quit the browser

Not if the power fails to quit the browser.
 
A

ASM

Randy Webb a écrit :
ASM said the following on 2/26/2007 4:50 AM:


You hope they fire.

Exacktelelly, we hope that does, and we hope the server continues to
run, and we hope the battery of conputer is ok, and we hope Windows
haven't lost its babies, and we hope the house is not destroying, and we
hope ...
Not if the power fails to quit the browser.

Nor if is the end of world.
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top