ignore security exception if window.top is in a different security context

eg. because SiteMgr contact-form is running in an iframe
This commit is contained in:
Ralf Becker 2017-03-08 14:14:16 +01:00
parent 1c80a22413
commit d1b963c98b

View File

@ -81,17 +81,19 @@
catch(e) { catch(e) {
// ignore SecurityError exception if opener is different security context / cross-origin // ignore SecurityError exception if opener is different security context / cross-origin
} }
if (typeof window.egw != 'undefined') try {
{ // try finding it in top
// set in above try block if (typeof window.egw == 'undefined' && window.top && typeof window.top.egw != 'undefined')
}
else if (window.top && typeof window.top.egw != 'undefined')
{ {
window.egw = window.top.egw; window.egw = window.top.egw;
if (typeof window.top.framework != 'undefined') window.framework = window.top.framework; if (typeof window.top.framework != 'undefined') window.framework = window.top.framework;
if (debug) console.log('found egw object in top'); if (debug) console.log('found egw object in top');
} }
else }
catch(e) {
// ignore SecurityError exception if top is different security context / cross-origin
}
if (typeof window.egw == 'undefined')
{ {
window.egw = { window.egw = {
prefsOnly: true, prefsOnly: true,