Persisting window objects across page browsing

V

VisionSet

Anyone know why this line fails to print anything?

document.write(window.top.myWindowArray.name);

For that matter, neither does this:

document.write('>>' + window.top.myWindowArray.name);

I don't get any errors and other writes before and after work fine.
myWindowArray is not null and does have elements.

Also the higher problem is that I'm trying to maintain my own collection of
windows that persist regardless of page browsing. So I've put them in
window.top. I tried window.navigator but there was a permission problem
retrieving the window properties.
What would be the best way to manage this global persistence?

TIA,
Mike W
 
R

Randy Webb

VisionSet said the following on 7/20/2006 6:19 PM:
Anyone know why this line fails to print anything?

document.write(window.top.myWindowArray.name);


Hmmm. Any idea why my stereo doesn't work? Point being, context is
everything.

top is a reserved word in JS. Are you naming your persistent window top
or are you referring to the top window in a frameset?

window.frames.top.myWindowArray[1].name
For that matter, neither does this:

document.write('>>' + window.top.myWindowArray.name);


The only difference being you added >>
I don't get any errors and other writes before and after work fine.
myWindowArray is not null and does have elements.

What window is it in though?
Also the higher problem is that I'm trying to maintain my own collection of
windows that persist regardless of page browsing. So I've put them in
window.top. I tried window.navigator but there was a permission problem
retrieving the window properties.
What would be the best way to manage this global persistence?

Show a sample page that displays that behavior.
 
V

VisionSet

Randy Webb said:
VisionSet said the following on 7/20/2006 6:19 PM:
Anyone know why this line fails to print anything?

document.write(window.top.myWindowArray.name);


Hmmm. Any idea why my stereo doesn't work? Point being, context is
everything.


Thought I'd done something daft, total JS newb and all.
top is a reserved word in JS. Are you naming your persistent window top
or are you referring to the top window in a frameset?

I'm hopefully refering to some object that is guaranteed to be available. I
don't really care what it is, I just want to stick my array in it.
window.frames.top.myWindowArray[1].name
For that matter, neither does this:

document.write('>>' + window.top.myWindowArray.name);


The only difference being you added >>


so I should get '>>' if (window.top.myWindowArray.name == "")
What window is it in though?

Some other window, but I'm assuming I can get global browsing persistent
storage by sticking it in a ref to window.top
Show a sample page that displays that behavior.

okay, when I get back to work in 9 hrs.

Thanks,
Mike W
 
R

Randy Webb

VisionSet said the following on 7/20/2006 6:38 PM:
Randy Webb said:
VisionSet said the following on 7/20/2006 6:19 PM:
Anyone know why this line fails to print anything?

document.write(window.top.myWindowArray.name);

Hmmm. Any idea why my stereo doesn't work? Point being, context is
everything.


Thought I'd done something daft, total JS newb and all.


Nah, just my warped sense of humor at times.
I'm hopefully refering to some object that is guaranteed to be available. I
don't really care what it is, I just want to stick my array in it.

Then don't use top as it is a reserved word that has a meaning in
certain context and window.top will freak it out.
window.frames.top.myWindowArray[1].name
For that matter, neither does this:

document.write('>>' + window.top.myWindowArray.name);

The only difference being you added >>


so I should get '>>' if (window.top.myWindowArray.name == "")
What window is it in though?

Some other window, but I'm assuming I can get global browsing persistent
storage by sticking it in a ref to window.top


Choose a different variable name. window.myPersistentStorage
 
V

VisionSet

Randy said:
Choose a different variable name. window.myPersistentStorage

But I thought that each browsed page got a new variable environment so
myPersistentStorage would not be persistent since the window object
would be a different one after a page browse???

Mike W
 
R

Randy Webb

VisionSet said the following on 7/21/2006 4:24 AM:
But I thought that each browsed page got a new variable environment so
myPersistentStorage would not be persistent since the window object
would be a different one after a page browse???

Yes it would.

If you want to maintain variables across pages then you will either have
to use a hidden frameset and maintain your variables in the frameset
itself, use cookies (with the limitations), or track your variables on
the server and reproduce them in each page.
 

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,755
Messages
2,569,536
Members
45,017
Latest member
GreenAcreCBDGummiesReview

Latest Threads

Top