Handles the case where browser is blocking popups and prevents from opening authentication window.

This commit is contained in:
paweldomas 2014-12-16 19:04:22 +01:00
parent ba627718be
commit 78f8521145
2 changed files with 12 additions and 1 deletions

7
app.js
View File

@ -1074,6 +1074,13 @@ function authenticateClicked() {
roomName, doJoinAfterFocus); roomName, doJoinAfterFocus);
authenticationWindow = null; authenticationWindow = null;
}); });
if (!authenticationWindow) {
Toolbar.showAuthenticateButton(true);
messageHandler.openMessageDialog(
null, "Your browser is blocking popup windows from this site." +
" Please enable popups in your browser security settings" +
" and try again.");
}
}); });
}; };

View File

@ -89,6 +89,9 @@ var messageHandler = (function(my) {
* @param h the height of the popup window * @param h the height of the popup window
* @param onPopupClosed optional callback function called when popup window * @param onPopupClosed optional callback function called when popup window
* has been closed. * has been closed.
*
* @returns popup window object if opened successfully or undefined
* in case we failed to open it(popup blocked)
*/ */
my.openCenteredPopup = function (url, w, h, onPopupClosed) { my.openCenteredPopup = function (url, w, h, onPopupClosed) {
var l = window.screenX + (window.innerWidth / 2) - (w / 2); var l = window.screenX + (window.innerWidth / 2) - (w / 2);
@ -96,7 +99,7 @@ var messageHandler = (function(my) {
var popup = window.open( var popup = window.open(
url, '_blank', url, '_blank',
'top=' + t + ', left=' + l + ', width=' + w + ', height=' + h + ''); 'top=' + t + ', left=' + l + ', width=' + w + ', height=' + h + '');
if (onPopupClosed) { if (popup && onPopupClosed) {
var pollTimer = window.setInterval(function () { var pollTimer = window.setInterval(function () {
if (popup.closed !== false) { if (popup.closed !== false) {
window.clearInterval(pollTimer); window.clearInterval(pollTimer);
@ -104,6 +107,7 @@ var messageHandler = (function(my) {
} }
}, 200); }, 200);
} }
return popup;
}; };
/** /**