Shawn- Digital Point Detecting Pop-up blocker script

Discussion in 'PHP' started by ProductivePC, Apr 13, 2005.

  1. #1
    Shawn,

    Can you please share that pop-up blocker detection script that DP uses?

    I had my popup blocker on so it blocked the popup window for a PM that I received. I then received a JS alert telling me that I possibly have a pop-up blocker on.

    If this thread needs to be in JavaScript or something I can move it there. I have it here due to the fact that DP is in PHP.

    Thanks,
     
    ProductivePC, Apr 13, 2005 IP
  2. rvarcher

    rvarcher Peon

    Messages:
    69
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    
    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.");
    }
    
    Code (markup):
    This script was posted by Donovan Kuhn at http://www.jguru.com/faq/view.jsp?EID=1157429

    Looks good to me. Haven't tested it though.

    Found it with a google search for: notify if pop up was blocked

    DP's notification is probably a built in part of vBulletin.
     
    rvarcher, Apr 13, 2005 IP