How Do I Detect That My Pop-up Window Failed (due To A Pop-up Blocker)?
Possible Duplicate: How can I detect if a browser is blocking a popup? I want to open a new window (onclick) to a page on Facebook (facebook.com/sharer.php). However, if this fa
Solution 1:
if(!window.open()){
//pop up failed.
}
Solution 2:
$('#anchor').click(function(){
if(!window.open()){
//pop up failed.
window.open('http://www.example.net/'); // open url in new tab
window.location = "http://www.example.net/" // open in current window
}
});
Post a Comment for "How Do I Detect That My Pop-up Window Failed (due To A Pop-up Blocker)?"