provide for popup blockers when window.open returns undefined, throw nice error

This commit is contained in:
Zhenya
2015-06-12 15:29:36 -07:00
parent 4b3c5b930a
commit 4fbf717178

View File

@@ -56,7 +56,16 @@ var openCenteredPopup = function(url, width, height) {
',left=' + left + ',top=' + top + ',scrollbars=yes');
var newwindow = window.open(url, 'Login', features);
if (typeof newwindow === 'undefined') {
// blocked by a popup blocker maybe?
var err = new Error("The popup was blocked by the browser");
err.attemptedUrl = url;
throw err;
}
if (newwindow.focus)
newwindow.focus();
return newwindow;
};