beefproject/beef — Issue #7: Add beefjs API Function: Popup Blocker
Author: passbe
Created: 2011-12-10 21:05:40+00:00
State: open

Add a function to the beefjs api (/modules/beefjs/browser.js) called hasPopups() to detect if popup windows are allowed. When the function is executed the hooked browser user must not notice.

The below code snipped was copied from: http://www.jguru.com/faq/view.jsp?EID=1157429

function IsPopupBlocker() {
var oWin = window.open("","testpopupblocker","width=100,height=50,top=5000,left=5000");
if (oWin==null || typeof(oWin)=="undefined") {
return true;
} else {
oWin.close();
return false;
}
}

if (IsPopupBlocker()) {
document.write("You HAVE A POPUP BLOCKER");
} else {
document.write("Popup blocker NOT detected.");
}
Google Code Issue: http://code.google.com/p/beef/issues/detail?id=159