Sfoglia il codice sorgente

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

master
paweldomas 10 anni fa
parent
commit
78f8521145
2 ha cambiato i file con 12 aggiunte e 1 eliminazioni
  1. 7
    0
      app.js
  2. 5
    1
      message_handler.js

+ 7
- 0
app.js Vedi File

@@ -1074,6 +1074,13 @@ function authenticateClicked() {
1074 1074
                     roomName, doJoinAfterFocus);
1075 1075
                 authenticationWindow = null;
1076 1076
             });
1077
+        if (!authenticationWindow) {
1078
+            Toolbar.showAuthenticateButton(true);
1079
+            messageHandler.openMessageDialog(
1080
+                null, "Your browser is blocking popup windows from this site." +
1081
+                " Please enable popups in your browser security settings" +
1082
+                " and try again.");
1083
+        }
1077 1084
     });
1078 1085
 };
1079 1086
 

+ 5
- 1
message_handler.js Vedi File

@@ -89,6 +89,9 @@ var messageHandler = (function(my) {
89 89
      * @param h the height of the popup window
90 90
      * @param onPopupClosed optional callback function called when popup window
91 91
      *        has been closed.
92
+     *
93
+     * @returns popup window object if opened successfully or undefined
94
+     *          in case we failed to open it(popup blocked)
92 95
      */
93 96
     my.openCenteredPopup = function (url, w, h, onPopupClosed) {
94 97
         var l = window.screenX + (window.innerWidth / 2) - (w / 2);
@@ -96,7 +99,7 @@ var messageHandler = (function(my) {
96 99
         var popup = window.open(
97 100
             url, '_blank',
98 101
             'top=' + t + ', left=' + l + ', width=' + w + ', height=' + h + '');
99
-        if (onPopupClosed) {
102
+        if (popup && onPopupClosed) {
100 103
             var pollTimer = window.setInterval(function () {
101 104
                 if (popup.closed !== false) {
102 105
                     window.clearInterval(pollTimer);
@@ -104,6 +107,7 @@ var messageHandler = (function(my) {
104 107
                 }
105 108
             }, 200);
106 109
         }
110
+        return popup;
107 111
     };
108 112
 
109 113
     /**

Loading…
Annulla
Salva