Popup Blocker Detection 2 | JavaScriptSource

Popup Blocker Detection 2

Jeff Johnson Dec 20, 2006

General

This is a simple, cross-browser method for testing for pop-up blockers. Most scripts test the return value of window.open and conclude that there is a blocker installed if the returned value resolves to false in a boolean statement. However, these scripts fail with browsers such as Opera (as of v9) that return a window object but disable it. This script properly handles this, as well as a null or undefined return type.


Notes

  • Created by: Jeff Johnson
  • Posted: December 20, 2006

Source Code

Paste this source code into the designated areas.

External file

Paste this code into an external JavaScript file named: detectPopupBlocker.js


Head

Paste this code into the HEAD section of your HTML document.


Leave a Response

(0 comments)