473,770 Members | 2,781 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

javascript variables persisting across a reload?

Hi,

Can anyone tell me if there is a way to set a variable in javascript and
have that persist so that it can be picked up by the next page in the
window?

In this case I will actually navigate to the page myself by setting
document.URL. I am happy to do this in a different way but I don't want to
pop up a sub window. I want to pass some javascript stuff into the next page
without having to serialize it all and post it to the server.

Andy

Jul 20 '05 #1
2 5654


Andy Fish wrote:
Hi,

Can anyone tell me if there is a way to set a variable in javascript and
have that persist so that it can be picked up by the next page in the
window?

In this case I will actually navigate to the page myself by setting
document.URL. I am happy to do this in a different way but I don't want to
pop up a sub window. I want to pass some javascript stuff into the next page
without having to serialize it all and post it to the server.


You would need to redesign your web page to use a frameset, then you can
store variables in
top.varName
and they are persisted as long as only the frame with your content is
changed.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2
thanks

I think I will do something similar to your suggestion but use window.opener
instead since my window has a 'parent'

"Martin Honnen" <Ma***********@ t-online.de> wrote in message
news:3F******** ******@t-online.de...


Andy Fish wrote:
Hi,

Can anyone tell me if there is a way to set a variable in javascript and
have that persist so that it can be picked up by the next page in the
window?

In this case I will actually navigate to the page myself by setting
document.URL. I am happy to do this in a different way but I don't want to pop up a sub window. I want to pass some javascript stuff into the next page without having to serialize it all and post it to the server.


You would need to redesign your web page to use a frameset, then you can
store variables in
top.varName
and they are persisted as long as only the frame with your content is
changed.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #3

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

Similar topics

3
5976
by: M Wells | last post by:
Hi All, Just wondering how you go about changing the value of a session cookie via javascript? I have a PHP page that sets a session cookie when it first loads. I'd like to be able to change the value of that session cookie in response to a button click in a form, without resubmitting the page. For some reason, the following doesn't seem to work:
13
4295
by: Craig | last post by:
Hey all, Here's the situation: - two websites, one on domain1 and the other on domain2 - domain1 opens a new window which is a javascript app from domain2 - domain1 needs to communicate with the javascript app on domain2 The problem occurs in that last step. Browsers don't allow script access across domains for security reasons, rightly so. Nonetheless, I still
3
45976
by: news.rcn.com | last post by:
How can I access the request and response object for a page using javascript. I want to stick some data on with something like request.setAttribute( "User's choice for later use" ). I can't seem to find a reference to request or response objects in JavaScript either in Google Groups or O'Reilly's "JavaScript the Definitive Guide" (surely it should be in the latter, huh?) I know I could use a hidden form element but the data would be a...
4
4341
by: Sam | last post by:
I have an asp.net 2.0 app that uses a sitemap, Master Page, and has several content pages. While this feature has simplified the process of creating a data-driven site menu, it does seem to have some big restrictions. Namely, maintaining state on the Master Page across all content pages. I simply want to keep track of a key value across all content pages. The only solution I can come up with is using a session variable, which I hate.
0
9425
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10228
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8883
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7415
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5312
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5449
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3970
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3575
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.