mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
provide for popup blockers when window.open returns undefined, throw nice error
This commit is contained in:
@@ -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;
|
||||
};
|
||||
Reference in New Issue
Block a user