Click to See Complete Forum and Search --> : What constitutes the DOM opener object?


CurtM
08-21-2003, 06:32 PM
Does opener refer to a window or a document in a window?

In a popup window, I have something like:

opener.myform.myinput.value = this.value

Shouldn't that statement always work, as long as the opener window has a form called myform with an input called myinput?

It works for me as long as the URL of the opener remains the same. I can refresh the window with an updated document from the same URL, and the above statement still works from the same popup.

But if the opener loads a document from a different URL, even though the new document still has a myform.myinput object, the above statement in the same popup no longer works.

Which leads me to believe that opener really doesn't refer to the window, rather a document in the window loaded from a specific URL.

Charles
08-21-2003, 07:03 PM
"opener" is always a Window object. I suspect that you are running into one of JavaScript's little security features. You are not allowed to play around with other people's sites.

CurtM
08-21-2003, 08:41 PM
Originally posted by Charles
"opener" is always a Window object. I suspect that you are running into one of JavaScript's little security features. You are not allowed to play around with other people's sites.

I'm not playing around with other people's sites; these are my sites. All are under the same server application context, but my different servlets use different URL's.

AdamBrill
08-21-2003, 10:57 PM
You cannot access it from across domains for security reasons. If I'm not mistaken, it should work fine as long as you stay in the same domain...

CurtM
08-22-2003, 06:13 PM
Thanks, you are right. I finally got it to work with different URLs in the same domain.