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) {
// 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,