473,327 Members | 1,976 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

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

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

Feb 26 '07 #1
4 1912
windandwaves <nf*******@gmail.comwrote:
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 ;-)
--
Une Bévue
Feb 26 '07 #2
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


--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Feb 26 '07 #3
ASM said the following on 2/26/2007 4:50 AM:

<snip>
<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.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Feb 26 '07 #4
ASM
Randy Webb a écrit :
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.
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 ...
>- you quit the browser

Not if the power fails to quit the browser.
Nor if is the end of world.

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Feb 26 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: ndsoumah | last post by:
hello guys I'm trying to get access to variables I put in a session variable from another page and it fails... here's the exact situation main file page1.php
1
by: Rich | last post by:
Hello, I want to create a cookie that will expire in a few mintues after a user leaves my page so that they can return without having to login again if they were only gone for a few minutes. I...
9
by: Marco Krechting | last post by:
Hi All, I have a page with a list of hyperlinks. I want to save information in a cookie about the fact that I entered an hyperlink or not. When I click one of the hyperlinks I want this stored...
7
by: ehendrikd | last post by:
hi all i need some clarification on how the php session work in relation to cookies. we have a web site where users need to log in. a few of our users were having troubles with their browser...
5
by: | last post by:
Hi, I'm trying to use the cookie munging session handling behaviour of asp.net instead of cookies themselves as I'm finding quite a few people are barring cookies (especially AOL users). If I...
1
by: Steve Remer | last post by:
My application (relevant code snippets below) originally used Session variables in order to maintain state from page to page. After being unable to solve the mystery of why those variables were...
14
by: Coleen | last post by:
Hi All :-) We have an APSX application using VB.net as the code behind, which uses one or two session variables per page. These Session variables are passed to the final page and calculations...
5
by: Sandman | last post by:
I dont think I understand them. I've read the section on scope in the manual inside out. I'm running PHP 5.2.0 Here is the code I'm working on: //include_me.php <?php $MYVAR = array(); global...
103
by: chochote | last post by:
Hi, I have a PHP script that does some processing, and stores an error message as a variable. The script then redirects to another script with the error string in the URL, with the second script...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.