From 28746da776636e0d51586b02ddb0d32fde672483 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 8 Mar 2017 14:14:16 +0100 Subject: [PATCH] ignore security exception if window.top is in a different security context eg. because SiteMgr contact-form is running in an iframe --- api/js/jsapi/egw.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/api/js/jsapi/egw.js b/api/js/jsapi/egw.js index 3f7fe8fffe..786c6f9fa6 100644 --- a/api/js/jsapi/egw.js +++ b/api/js/jsapi/egw.js @@ -81,17 +81,19 @@ catch(e) { // ignore SecurityError exception if opener is different security context / cross-origin } - if (typeof window.egw != 'undefined') - { - // set in above try block + try { + // try finding it in top + if (typeof window.egw == 'undefined' && window.top && typeof window.top.egw != 'undefined') + { + window.egw = window.top.egw; + if (typeof window.top.framework != 'undefined') window.framework = window.top.framework; + if (debug) console.log('found egw object in top'); + } } - else if (window.top && typeof window.top.egw != 'undefined') - { - window.egw = window.top.egw; - if (typeof window.top.framework != 'undefined') window.framework = window.top.framework; - if (debug) console.log('found egw object in top'); + catch(e) { + // ignore SecurityError exception if top is different security context / cross-origin } - else + if (typeof window.egw == 'undefined') { window.egw = { prefsOnly: true,