popup closes main window problem

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

    popup closes main window problem

    Hi,

    I have a simple page on my freebie account site that opens a popup
    window running index.asp on another site of mine. The code on the
    freebie hosted server is below. What I'd like to do is have the
    freebie hosted page shut down once it's opened up the child window.

    Any ideas? Thanks

    David

    <html>

    <script language="JavaS cript" type="text/javascript">
    function popup() {
    window.open( "http://www.mysite/index.asp" ,
    'newwin','toolb ars,menubar,scr ollbars=yes,too lbar=1' ) ;
    }
    </script>

    <BODY onLoad="javascr ipt:popup()">
    </body
    </html>
  • Grant Wagner

    #2
    Re: popup closes main window problem

    David wrote:
    [color=blue]
    > Hi,
    >
    > I have a simple page on my freebie account site that opens a popup
    > window running index.asp on another site of mine. The code on the
    > freebie hosted server is below. What I'd like to do is have the
    > freebie hosted page shut down once it's opened up the child window.
    >
    > Any ideas? Thanks
    >
    > David
    >
    > <html>
    >
    > <script language="JavaS cript" type="text/javascript">
    > function popup() {
    > window.open( "http://www.mysite/index.asp" ,
    > 'newwin','toolb ars,menubar,scr ollbars=yes,too lbar=1' ) ;
    > }
    > </script>
    >
    > <BODY onLoad="javascr ipt:popup()">
    > </body
    > </html>[/color]

    <body onload="popup() ;window.close() ;">

    Since you likely didn't open the window the person is viewing the page
    containing the above with script, the user will either be prompted
    whether they want the window to close (IE, Netscape 4), or it will fail
    with an error in the JavaScript Console (Mozilla).

    You can't close a window with script that you didn't open with script
    (it's more complicated then that, but that's the basic idea)

    --
    | 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...