Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

open and close a window (html/javascript)

  • 21-08-2003 2:35pm
    #1
    Banned (with Prison Access) Posts: 13,018 ✭✭✭✭


    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