Sfoglia il codice sorgente

stag-popup.js - catch & report page load errors instead of hanging

Vijayakrishnan 3 anni fa
parent
commit
d1c58c43ef
1 ha cambiato i file con 5 aggiunte e 1 eliminazioni
  1. 5 1
      public/js/stag-popup.js

+ 5 - 1
public/js/stag-popup.js

@@ -80,7 +80,8 @@ function convertContentLinksForInPopupNavigation(popup) {
         }
     });
 }
-function openDynamicStagPopup(url, initer, title, updateParent, style = '', replace = false) {
+function openDynamicStagPopup(_url, initer, title, updateParent, style = '', replace = false) {
+    let url = _url;
     if(url.indexOf('popupmode') === -1) {
         url += (url.indexOf('?') !== -1 ? '&' : '?') + 'popupmode=1';
     }
@@ -138,6 +139,9 @@ function openDynamicStagPopup(url, initer, title, updateParent, style = '', repl
         runMCInitializer('pro-suggest'); // not the place for this! Move to better place.
         initMoes();
         hideMask();
+    }).fail(() => {
+        toastr.error('Unable to open ' + _url);
+        hideMask();
     });
 }
 function isDynamicStagPopupPresent() {