Search code examples
javascriptsecurityurlinternet-explorer-8popup-blocker

Popup blocker IE8 and security zones


I have read many posts regarding detection of popup blocker by javascript code but still have not been able to find an answer to the problem I am having now.

The problem is when the target url is an external website, my browser (IE8) prevents access to window object, or in other words the javascript code window.open() returns null although the popup is allowed to open up. In contrary, for a local page of the site, javascript returns the window object.

Thus it seems there is a security settings somewhere in Internet Options that prevents grabbing the handler of the opened window; in which case, does anyone know how to detect it with javascript?

The code I am using is as follows and it cannot detect this situation:

var popup = window.open("http://www.externalsite.com&param1=value1", "_blank", "");
if (!popup) {
alert('Cannot preview this page because pop-ups are blocked by your browser');
} else {
if (popup != null) { popup.focus(); }
}

Solution

  • If you open a window that crosses Zones and Integrity levels (e.g. Intranet page running at Medium opens Internet page running at low; or Internet site running at Low opens Trusted site running at medium) this can happen. That has nothing to do with the popup blocker.