window.opener

  • Thread starter Raphael Bowen Giudice
  • Start date
R

Raphael Bowen Giudice

I'm opening a window in my main page using the window.open() function.
With the new window opened, how do I call a function or an object from
the main page. I'm using the window.opener() function but I receive a
"persmission denied" error from the browser. Is there another way of
doing this? Thanks.
 
B

Brian Genisio

Raphael said:
I'm opening a window in my main page using the window.open() function.
With the new window opened, how do I call a function or an object from
the main page. I'm using the window.opener() function but I receive a
"persmission denied" error from the browser. Is there another way of
doing this? Thanks.


opener is a property, not a method...

var myOpener = window.opener; // correct
var myOpener = window.opener(); // incorrect

Brian
 
G

Grant Wagner

Raphael said:
I'm opening a window in my main page using the window.open() function.
With the new window opened, how do I call a function or an object from
the main page. I'm using the window.opener() function but I receive a
"persmission denied" error from the browser. Is there another way of
doing this? Thanks.

window.opener() isn't a "function", it's a property, window.opener, which
contains a reference to the window object that opened the current window.
So to call back into the opener to run a function, you'd use:

if (window.opener && window.opener.yourFunction) {
window.opener.yourFunction();
}

--
| Grant Wagner <[email protected]>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtml_reference_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-developer/upgrade_2.html
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top