Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5

Thread: Closing window

  1. #1
    New to the CF scene
    Join Date
    Jul 2003
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Closing window

    hallo.. just a question... I've a script that closes a window after having runned a swf file.... the browser asks me if I want the application can close the window... is it possible not to have this confirm?? I want the window be closed without prompting me for confirmation....

    thank you.....

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Try open that window using JavaScript. If you open that window with window.open() function, window.close() function will close it without promt. I think self.close will do the same.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    New to the CF scene
    Join Date
    Jul 2003
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks for your answer,but it does not work...
    I paste here the script so that you can help me....

    <script language="JavaScript">
    function launchwin(){
    newwin = window.open("","flashcamwin","fullscreen=1,scrollbars=1")
    newwin.resizeBy(15,0)
    var htmlString=.......

    here there's the definition of the flash file that will be loaded.... then the scripts finishes as it follows....

    newwin.document.open();
    newwin.document.write(htmlString)
    newwin.document.close()

    and this is the body...... <BODY onLoad="launchwin()"></BODY>

    ????? what can I do?

  • #4
    New Coder
    Join Date
    May 2003
    Location
    UK
    Posts
    68
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I had the same problem and this is how I solved it...


    May not be the best way.

    I open up a second window (full screen size) - most people wouldn't even notice that a new window has opened.
    This page shows whatever was requested.

    The page in the new window has a link "close" which runs the javascript onclick="window.close()"


    Like i said maybe not what you're after but it works cleanly!
    They only tell you its a stupid question when they don't know the answer!

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Posts
    262
    Thanks
    0
    Thanked 0 Times in 0 Posts

    The answer lies below

    This is cool.

    <html>

    <head>
    <title>Self closing - No warning</title>
    <script language="javascript">
    var i = 0;

    function closeMe() {
    i++;
    document.mainForm.myTime.value = 7-i;
    if(i==7) { // wait five seconds
    window.opener = top;
    window.close();
    }
    setTimeout("closeMe()",1000);
    }
    </script>
    </head>

    <body>
    <form name="mainForm">
    <font face="Arial, Helvetica, Sans-Serif" size="2">This window will close in
    <input type="text" name="myTime" size=2> <font face="Arial, Helvetica, Sans-Serif" size="2">seconds.
    </SPAN></form>
    <script language="javascript">
    closeMe();
    </script>
    </body>
    </html>

    In the form section, simply place your content. Enjoy.
    Therapy is expensive, popping bubble wrap is cheap, you choose.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •