How to determine if the IE pop-up window is blocked

Source: Internet
Author: User

On the login page of our project, a pop-up window is opened to open the main homepage. Here, the pop-up window will be blocked by IE, we cannot prevent all clients from allowing a pop-up window by default, but we can give user related prompts.

The following code is from the project logon page:

Function openmain ()
{
/* The URL is the path of the main window */
VaR url = "Main. Do ";
/* Winparms indicates some property settings for window opening */
VaR winparms = "Height =" + (window. Screen. availheight-47) + ",";
Winparms + = "width =" + (window. Screen. availwidth-13) + ",";
Winparms + = "Left = 0 ,";
Winparms + = "Top = 0 ,";
Winparms + = "status = Yes, toolbar = No, menubar = No, location = No, resizable = Yes, scrollbars = Yes ,";
/* Omodal is used to monitor whether the pop-up window is blocked by IE */
VaR omodal = Window. Open (URL, "_ blank", winparms );
// When omodal = undefined, the IE pop-up window is blocked.
// Conjecture: the principle of IE blocking should be that if a window is opened, the window is closed immediately. Therefore, omodal is undefined.
If (omodal! = Undefined)
{
// If the window is successfully opened, the login window is closed, so that opener is null. When close is called, no message is displayed indicating whether to close the window.
Window. Opener = NULL;
Window. Close ();
} Else
{
Alert ("your IE stops the pop-up window. In order to be able to use the system normally, please allow the pop-up window on this site! Thank you! ");
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.