commit 2dc01daf505c0fd03fea9f61df7006ea6b80d0ca
parent 3df86939bc3afabc20c0c45120084ad9f2cc0ce4
Author: myadzel <myadzel@gmail.com>
Date: Tue, 27 Nov 2018 23:46:11 +0300
display message when popup window is blocked #162
Diffstat:
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/lib/popup-window/index.js b/src/lib/popup-window/index.js
@@ -1,3 +1,5 @@
+import alertify from 'alertify.js';
+
function openPopupWindow(url, width, uniqName = null) {
var left, top, height,
screenLeft = screen.availLeft || 0,
@@ -19,8 +21,14 @@ function openPopupWindow(url, width, uniqName = null) {
height = window.innerHeight;
var features = 'width=' + width + ',height=' + height + ',left=' + left + ',top=' + top;
features += ',resizable,scrollbars';
- window.open(url, uniqName, features)
- .focus();
+ var newWindow = window.open(url, uniqName, features);
+ if (!newWindow || newWindow.closed) {
+ alertify.alert('Pop-up blocked by browser.\n\n' +
+ 'If you want to use the full functionality of this site, ' +
+ 'turn off blocking pop-up in the browser settings for this site.');
+ } else {
+ newWindow.focus();
+ }
}
export {openPopupWindow};