From 3f8acc1fd1655bebdd7f6ccda6817ed538cfead6 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 27 Nov 2014 17:34:06 +0000 Subject: [PATCH] set opener as early as possible for framework popups --- phpgwapi/js/jsapi/egw.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/phpgwapi/js/jsapi/egw.js b/phpgwapi/js/jsapi/egw.js index f40d0e623b..94b9a9d445 100644 --- a/phpgwapi/js/jsapi/egw.js +++ b/phpgwapi/js/jsapi/egw.js @@ -43,6 +43,20 @@ var start_time = (new Date).getTime(); if(typeof console != "undefined" && console.timeline) console.timeline("egw"); + // set opener as early as possible for framework popups (not real popups) + if (!window.opener && window.parent !== window) + { + try { + if (window.parent.framework && typeof window.parent.framework.popup_idx == 'function' && + window.parent.framework.popup_idx.call(window.parent.framework, window) !== undefined) + { + window.opener = window.parent; + } + } + catch(e) { + // ignore SecurityError exception if opener is different security context / cross-origin + } + } // Flag for if this is opened in a popup var popup = (window.opener != null);