window.opener

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Raphael Bowen Giudice

    window.opener

    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
    "persmissio n denied" error from the browser. Is there another way of
    doing this? Thanks.
  • Brian Genisio

    #2
    Re: window.opener

    Raphael Bowen Giudice wrote:
    [color=blue]
    > 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
    > "persmissio n denied" error from the browser. Is there another way of
    > doing this? Thanks.[/color]


    opener is a property, not a method...

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

    Brian

    Comment

    • Grant Wagner

      #3
      Re: window.opener

      Raphael Bowen Giudice wrote:
      [color=blue]
      > 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
      > "persmissio n denied" error from the browser. Is there another way of
      > doing this? Thanks.[/color]

      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.y ourFunction) {
      window.opener.y ourFunction();
      }

      --
      | Grant Wagner <gwagner@agrico reunited.com>

      * Client-side Javascript and Netscape 4 DOM Reference available at:
      *


      * Internet Explorer DOM Reference available at:
      *
      Find official documentation, practical know-how, and expert guidance for builders working and troubleshooting in Microsoft products.


      * 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-deve...upgrade_2.html


      Comment

      Working...