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 2 of 2
  1. #1
    Regular Coder
    Join Date
    Apr 2006
    Posts
    133
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Checking if the new window is blocked.

    Hello,

    I have a self submitting form which opens in a new window using the following code.

    <script type="text/JavaScript" language="JavaScript">
    document.myform.submit();
    </script>

    The form tag is as follows:
    <form target="_blank" method="post" name="myform" id="myform" action="https://bankssecurewebsiteaddress">
    The web site is made with Javascript and ASP.
    Is there a way to check if the new window opened or blocked by a popup blocker with Javascript? Or possibly ASP?

    Thanks
    telmessos

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,314
    Thanks
    203
    Thanked 2,564 Times in 2,542 Posts
    Code:
    var newWin = window.open(.....parameters.....);
    if (newWin && newWin.top) {
    // popup has opened
    } else {
    // popup has been blocked
    }

    Alternatively if you just need to have extra code to run if the window fails to open you can test if (!newWin || !newWin.top).


    Quizmaster: In Roman Catholicism, baptism, confirmation and matrimony are three of the seven what?
    Contestant: Deadly sins.

  • Users who have thanked Philip M for this post:

    telmessos (09-25-2008)


  •  

    Posting Permissions

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