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

Close Window button in jsp

Options
  • 05-06-2007 4:37pm
    #1
    Registered Users Posts: 1,552 ✭✭✭


    Ive tried using the code below to make a close window button in a jsp but when I press it it doesnt do anything and the window remains open.

    <form method="post">
    <input type="button" value="Close Window" onclick="window.close()">
    </form>

    It works ok with ie but wont work with firefox.


Comments

  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    In firefox window.close() will only work for windows opened with window.open() IIRC.


  • Moderators, Politics Moderators Posts: 39,822 Mod ✭✭✭✭Seth Brundle


    JSP (and Java) is NOT JavaScript


  • Registered Users Posts: 1,552 ✭✭✭quinnd6


    Im using javascript within a jsp and know the difference between them cheers.
    Here's something else I tried and didn't work

    <head>
    <script language="javascript" type="text/javascript">


    var browserName=navigator.appName;
    if (browserName=="Netscape")
    {
    function closeWindow()
    {
    window.open('','_parent','');

    window.close();
    }


    }
    else
    {
    if(browserName = "Microsoft Internet Explorer")
    {
    function closeWindow()
    {
    window.close();
    }
    }
    }
    </script>


  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    I doubt you'll get anything working in Firefox.


Advertisement