473,418 Members | 2,072 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,418 software developers and data experts.

pass variables from one page to another in same window

Hi,

I have a javascript solution where page A launches page B in a second window
and then they can pass data between them. That's all well and good.

Now say page B wants to navigate to page C (i.e. in the same window as page
B is currently in, and I want to pass information from B to C.

Currently I have it that B passes the information back to A before loading
C, and C then picks it up from A.

Any easier way to do this? it must be wholly client side and not
browser-specific.

Many thanks,

Andy
Jul 23 '05 #1
7 6839
Lee
Andy Fish said:

Hi,

I have a javascript solution where page A launches page B in a second window
and then they can pass data between them. That's all well and good.

Now say page B wants to navigate to page C (i.e. in the same window as page
B is currently in, and I want to pass information from B to C.

Currently I have it that B passes the information back to A before loading
C, and C then picks it up from A.

Any easier way to do this? it must be wholly client side and not
browser-specific.


That's what cookies are for.

If you can't rely on cookies being enabled, you can encode values
in the URL of page C by appending a "?" followed by your information:

location="http://myserver/pageC.html?John+Smith";
or
location="http://myserver/pageC.html?a=47&b=28&id=John+Smith";

Your pageC.html contains code to parse the data out of location.search.

Google for "pass values pages javascript"

Jul 23 '05 #2

"Lee" <RE**************@cox.net> wrote in message
news:c9*********@drn.newsguy.com...
Andy Fish said:

Hi,

I have a javascript solution where page A launches page B in a second windowand then they can pass data between them. That's all well and good.

Now say page B wants to navigate to page C (i.e. in the same window as pageB is currently in, and I want to pass information from B to C.

Currently I have it that B passes the information back to A before loadingC, and C then picks it up from A.

Any easier way to do this? it must be wholly client side and not
browser-specific.
That's what cookies are for.

If you can't rely on cookies being enabled, you can encode values
in the URL of page C by appending a "?" followed by your information:

location="http://myserver/pageC.html?John+Smith";
or
location="http://myserver/pageC.html?a=47&b=28&id=John+Smith";

Your pageC.html contains code to parse the data out of location.search.


Thanks lee. Unfortunately I need to pass some nested structures around
rather than a couple of simple values, so I think I will probably stick with
my original idea.

At least I know I wasn't missing out on anything obvious
Google for "pass values pages javascript"

Jul 23 '05 #3
Lee
Andy Fish said:
Thanks lee. Unfortunately I need to pass some nested structures around
rather than a couple of simple values, so I think I will probably stick with
my original idea.


There are other options that amount to only replacing the visible
part of pageB with the visible part of pageC, by changing the
contents of a container such as an iframe.

If you're passing structures, then you're probably actually passing
references to them, which means that if the page that contains the
original data is closed, the other pages won't be able to access it.
That may not be a problem if that original page is vital, anyway.

Jul 23 '05 #4
Andy Fish wrote:
Hi,

I have a javascript solution where page A launches page B in a second window
and then they can pass data between them. That's all well and good.

Now say page B wants to navigate to page C (i.e. in the same window as page
B is currently in, and I want to pass information from B to C.

Currently I have it that B passes the information back to A before loading
C, and C then picks it up from A.

Any easier way to do this? it must be wholly client side and not
browser-specific.

Many thanks,

Andy

You could use frames, one of them invisible where you could keep track
all of your scripted elements.

Mick
Jul 23 '05 #5

"Lee" <RE**************@cox.net> wrote in message
news:c9*********@drn.newsguy.com...
Andy Fish said:
Thanks lee. Unfortunately I need to pass some nested structures around
rather than a couple of simple values, so I think I will probably stick withmy original idea.


There are other options that amount to only replacing the visible
part of pageB with the visible part of pageC, by changing the
contents of a container such as an iframe.

If you're passing structures, then you're probably actually passing
references to them, which means that if the page that contains the
original data is closed, the other pages won't be able to access it.
That may not be a problem if that original page is vital, anyway.


The main form (form A) is really a controlling window. although there's no
real concept of modal windows, the other window be modal if it were a VB
app, so I don't it's too much of a hack passing all the data back through
the main form.

Good idea about the frameset though - I will certainly try that if I get
into a similar situation wuthout having a separate main window to fall back
on.

cheers

Andy
Jul 23 '05 #6
I'm curious what your solution is for the simple example, since it
doesn't appear that you use cookies, frames or forms. Please let me know.

Amy

Andy Fish wrote:
Hi,

I have a javascript solution where page A launches page B in a second window
and then they can pass data between them. That's all well and good.

Now say page B wants to navigate to page C (i.e. in the same window as page
B is currently in, and I want to pass information from B to C.

Currently I have it that B passes the information back to A before loading
C, and C then picks it up from A.

Any easier way to do this? it must be wholly client side and not
browser-specific.

Many thanks,

Andy


Jul 23 '05 #7
"Andy Fish" <aj****@blueyonder.co.uk> wrote in message news:<i8*********************@news-text.cableinet.net>...
Hi,

I have a javascript solution where page A launches page B in a second window
and then they can pass data between them. That's all well and good.

Now say page B wants to navigate to page C (i.e. in the same window as page
B is currently in, and I want to pass information from B to C.

Currently I have it that B passes the information back to A before loading
C, and C then picks it up from A.

Any easier way to do this? it must be wholly client side and not
browser-specific.

Many thanks,

Andy

Too lazy to view the whole thread, but did anyone suggest an
invisible frame, or iframe to store such data. We're lucky here, our
app always has a left-side menu frame which shows, so information can
be stored in this frame, while the right side frames change and pick
up such information.
Jul 23 '05 #8

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

Similar topics

1
by: Dave Smithz | last post by:
Hi there, I have implemented a login sequence using session variables for a PHP/MySQL DB which I took over development. I read some books and this NG and it seemed straight forward. However the...
9
by: Pack Fan | last post by:
I've noticed that session variables will persist on Mac IE even after all browser windows have been closed. One must quit the program to clear the session variables. This presents a security risk...
2
by: macyp | last post by:
I have to pass values from one aspx page to another. The controls I have in the first page are: a textbox, 3 drop down lists, and 2 check boxes, and a submit button. It is a search page, and the...
3
by: drec | last post by:
I am creating a search box that the user types a value in, and then this gets passed to another page called search.php I would like to be able to pass these values through the URL, but I cant...
18
by: BillE | last post by:
When a user opens a new IE browser window using File-New-Window the integrity of an application which relies on session state is COMPLETELY undermined. Anyone who overlooks the fact that...
26
by: BillE | last post by:
Some ASP.NET applications use Session Variables extensively to maintain state. These should be re-written to use viewstate, hidden fields, querystring, etc. instead. This is because if a user...
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...
12
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms....
18
by: pinky8 | last post by:
I have an ASP page with a button and other things. When the button is clicked, it executes a javascript function which does: document.Form1.method = 'post'; document.Form1.action =...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.