Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

open and close a window (html/javascript)

  • 21-08-2003 03:35PM
    #1
    Banned (with Prison Access) Posts: 13,016 ✭✭✭✭


    how do i open a window and then close the window i was last on
    using javascript

    the code for opening is as follows

    function newWindow(frameset){
    blankWindow = window.open("frameset.html", "mysite", "toolbar = yes, status = yes, resizable = yes, location = yes, scrollbar = yes, width = 820, height = 550")
    }


    do i put in a

    blankWindow = window.close("mypage.html", "mysite")

    is that close or do i make an entirely new function??

    cheers?


Comments

  • Registered Users, Registered Users 2 Posts: 4,666 ✭✭✭Imposter


    blankWindow.close() I would imagine would do the trick.

    Have a look at http://developer.irt.org/script/script.htm
    They have a great FAQ that answers most queries you'll be likely to have when starting out with JS


  • Closed Accounts Posts: 304 ✭✭Zaltais


    window.close();

    will close the current window (i.e. the window that activates your popup)

    However, you may be better using a new function in the popup window itself.

    So in your new window have the following function

    closeIt(){
    window.opener.close();
    }

    and then

    <body onLoad="closeIt();">

    This way you know that your popup has opened successfully and the page has loaded correctly before you close the main window (and the user's only point of reference for your site if the popup doesn't open for any reason).


Advertisement