Skip to content

Instantly share code, notes, and snippets.

@deksoke
Forked from benkitzelman/isPopupBlocked.js
Last active August 29, 2015 14:12
Show Gist options
  • Save deksoke/34d25d85920195c9cd51 to your computer and use it in GitHub Desktop.
Save deksoke/34d25d85920195c9cd51 to your computer and use it in GitHub Desktop.
var isPopupBlocked = function() {
var isBlocked,
popup = window.open('about:blank', 'popup_test','width=5, height=5, left=0, top=0');
// pop under
if(popup) popup.blur();
window.focus();
isBlocked = !popup || typeof popup == 'undefined' || typeof popup.closed=='undefined' || popup.closed || popup.innerHeight == 0;
if(popup) popup.close();
return isBlocked;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment