Reference window.opener after redirecting the popup

  • Thread starter Etienne Charland
  • Start date
E

Etienne Charland

Hi, I have a simple problem that doesn't seem to have an easy solution. I
have a popup used in many places in the application. At the top of the page,
there is a link to switch between two views of the data. And in both views,
I need a reference to the opener window. The problem is... once I change
view, window.opener loose it's reference. How can I work-around that?

Since that popup is an utility used in many places, I must not have to
modify all the pages using it.

Thanks for your help!
Etienne
 
R

Rutger Smit

Etienne said:
Hi, I have a simple problem that doesn't seem to have an easy solution. I
have a popup used in many places in the application. At the top of the page,
there is a link to switch between two views of the data. And in both views,
I need a reference to the opener window. The problem is... once I change
view, window.opener loose it's reference. How can I work-around that?

Since that popup is an utility used in many places, I must not have to
modify all the pages using it.

Thanks for your help!
Etienne

Launch it from a 'hidden' frame (frameset of two frames with a width set
to * and 100%).



//Rutger
 
E

Etienne Charland

What will it change?

I'm a bit confused, are you talking about adding a frame (or iframe) to the
popup?
 
R

Rutger Smit

Etienne said:
What will it change?

I'm a bit confused, are you talking about adding a frame (or iframe) to the
popup?

You have to make a master frameset with a 100% height frame where all
your stuff wil happen (like the window with the pages right now).

The popup opens from the other frame. Now you can communicate from the
100% frame to the hidden frame and from the hidden frame you can
communicate with the popup.
Maybe you can even access the popup straight away with
parent.window["HiddenFrameName"].WindowOpener

WindowOpener is defined in the hidden frame JavaScript like
WindowOpener=window.open("MyPopup.aspx","bla","width=200, height="200");

I do not guarantee that you the above code is the working way, it meant
to be a idea which direction to search for a solution.

//Rutger
 
E

Etienne Charland

Oh. There's a detail I haven't explained clearly. It is the popup who switch
to another page, not the parent window. And it is the popup who needs to
access the parent.

Rutger Smit said:
Etienne said:
What will it change?

I'm a bit confused, are you talking about adding a frame (or iframe) to
the popup?

You have to make a master frameset with a 100% height frame where all your
stuff wil happen (like the window with the pages right now).

The popup opens from the other frame. Now you can communicate from the
100% frame to the hidden frame and from the hidden frame you can
communicate with the popup.
Maybe you can even access the popup straight away with
parent.window["HiddenFrameName"].WindowOpener

WindowOpener is defined in the hidden frame JavaScript like
WindowOpener=window.open("MyPopup.aspx","bla","width=200, height="200");

I do not guarantee that you the above code is the working way, it meant to
be a idea which direction to search for a solution.

//Rutger
 
R

Rutger Smit

Etienne said:
Oh. There's a detail I haven't explained clearly. It is the popup who switch
to another page, not the parent window. And it is the popup who needs to
access the parent.

news:[email protected]...



Still use the hidden vframe but in this case you can use it as a buffer.
Open the popup whenever you want, do the things with the pop you want,
store the values that you need later on in the hidden frame (using input
fields pr something like that).

Now you can close the popup, navigate in the main frame and when needed,
access the values in the hidden frame with JavaScript.

Question: why not use the Session object?

//Rutger
 
Joined
Aug 7, 2007
Messages
1
Reaction score
0
I found a solution for this problem.

In my case i needed to put in the main page a value that came from the popup so I used
top.opener.document.getElementById('codIdent').value = txt.innerHTML;

Try this!!
 

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,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top