top.opener doesn't work in Netscape


I have a window that opens another window with two frames. From one of
the frames I'm trying to get elements of the opening window. This code
works well in IE but not in Netscape 4.79. The alert in link_onclick
never shows up, and image_onclick gives an error "top.opener has no

What am I doing wrong? Thanks.


function link_onclick() {
    if ( top.opener ) {
        var loc = top.opener.location.href;
        var tit = top.opener.document.title;
        document.add_form.add.value =  ' <A HREF="' + loc + '">' + tit
+ '</A> ';

function image_onclick() {
   with ( top.opener.document ) {

***more code***

This is the relevant HTML:

<form name="add_form" method=post action="">
<table cellspacing=5>
<tr><td><input type=button name=add_link value="Add Link"
<td>Add a link to currently open page.</td></tr>
<tr><td><input type=button name=add_image value="Add Image"
<td>Add a picture from currently open page.</td></tr>
<input type=hidden name="add">
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ZvonkoSystems architectCommented:
I wonder why top.opener should ever work.

Top is the root of all windows.
opener is one associated window to the actual window.

That top.opener work is only a error tolerance and you get either top or opener.

Or did you name a frame or window "opener" ???

Actually, top.opener is one of many correct references to the opener.  Most commonly, it is window.opener, but in the case of a frameset in the popup, top.opener is most accurate.

Try this ... when you open the popup, do this:

   var mypopup = "mypopup.htm", "mypopup", "width=400,height=300" );

   mypopup.opener = self;

This should set the top.opener attribute for the popup.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jgenyukAuthor Commented:
No, I didn't name anything "opener". That was supposed to refer to the window that opened the  parent window to this frame. Is there another way to do this? Just "opener" doesn't work.
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

"..refer to the window that opened the parent window to this frame..."

so I assume it's the window.parent.opener right?
jgenyukAuthor Commented:
It  is but I'd like to go with "top" because I might add more nested frames later on. I'll try mypopup.opener = self .
maybe you just lack a "window" at the front:

in this case, window.parent == top (from within the frame).  but if there are no frames, then window == top == self.
jgenyukAuthor Commented:
mypopup.opener = self  works fine, thanks
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.