Reputation: 41
I am developing a site. in that site on clicking a button, it should redirect to the next page. My question is while clicking the button, it should check whether the browser's pop up blocker has been enabled or not. If it is enabled, then i should display an error message saying that the pop up has been blocked. Or else should move on to next page. Is it possible through the coding?? Please help me soon
Upvotes: 2
Views: 1129
Reputation: 7525
TO DETECT IF POPUP IS BLOCKED:
var newWin = window.open(url);
if(!newWin || newWin.closed || typeof newWin.closed=='undefined')
{
//POPUP BLOCKED
}
Upvotes: 0
Reputation: 15881
try like this. it will return true or false. for blockd pop up.
function isPopupBlocked()
{
var oWin = window.open("UrltoOpen","yourName","width=0,height=0,top=5000,left=5000");
if (oWin==null || typeof(oWin)=="undefined") {
return true;
} else {
oWin.close();
return false;
}
}
Upvotes: 2