Window Handles on Mac

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Simon Wigzell

    #1

    Window Handles on Mac

    I want one window to open another window which then changes the URL in the
    first window, Here are the 2 files, works fine on a PC running XP and IE,
    doesn't work on a iMac running OSX and IE, any ideas? On the mac the calling
    window just gets replaced with a blank.

    --------------------------main.htm------------------------------
    <html>
    <body>
    <script>
    window.name = "MPC";
    NewWindow = window.open('Ha ndleReplace.htm ',"NewWindow",' ');
    </script>
    </body>
    </html>
    ------------------------------------------------------------------
    --------------------------HandleReplace.h tm--------------------
    <html>
    <body>
    <script>
    windowHandle=wi ndow.open('','M PC','');
    windowHandle.lo cation.replace( "http://www.bbc.com");
    </script>
    </body>
    -------------------------------------------------------------------

    This is just a stripped down example that demonstrates the problem. Please
    don't ask me why I don't just go straight to the BBC website!




  • Robert

    #2
    Re: Window Handles on Mac

    "Simon Wigzell" <simonwigzell@s haw.ca> wrote in message news:<sPOQc.287 41$M95.6184@pd7 tw1no>...[color=blue]
    > I want one window to open another window which then changes the URL in the
    > first window, Here are the 2 files, works fine on a PC running XP and IE,
    > doesn't work on a iMac running OSX and IE, any ideas? On the mac the calling
    > window just gets replaced with a blank.
    >[/color]


    You may refere directly to global variables and DOM objects in child
    windows. Just proceed the reference with opener. This should work in
    all browsers. I tested this on IE 5.2 and Netscape 7.1 on MacOS
    10.2.6.

    Example & note the change in the extension:

    main.html
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE>First window</TITLE>

    <SCRIPT type="text/javascript">

    function openWin()
    {
    var newWindow = window.open('Ha ndleReplace.htm l',"NewWindow", '');
    }
    </script>

    <body onload='alert(" Open second window & change url " +
    "of this page.");
    openWin();'>
    <p>Possible solution for Window Handles on Mac.</P>
    </body>
    </html>

    HandelReplace.h tml
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE>second window</TITLE>
    <body>
    <script>
    // You can refer to the DOM and global variables in the
    // window that openned this page by preceding the
    // variables with opener.
    opener.location .replace("http://www.bbc.com");
    </script>
    <p>We have just changed the URL of the first window.</p>
    </body>


    Robert

    Comment

    Working...