Popup Blocker Detection in JavaScript
This crossbrowser script detects whether or not a popup blocker blocked a window.open.
function detectPopupBlocker() { var test = window.open(null,"","width=100,height=100"); try { test.close(); alert("Pop-ups not blocked."); } catch (e) { alert("Pop-ups blocked."); } } // Created by: Simon Willison // http://simon.incutio.com/archive/2004/05/26/addLoadEvent function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { if (oldonload) { oldonload(); } func(); } } } addLoadEvent(detectPopupBlocker); Sat, 23 Dec 2006 04:13 Posted in Javascript