dont send messages if not an iframe

This commit is contained in:
j 2014-09-24 00:00:00 +02:00
parent 4a2751839f
commit baeeff366e

View file

@ -185,7 +185,9 @@
}; };
that.postMessage = function() { that.postMessage = function() {
return Ox.Message.post.apply(this, Ox.slice(arguments)); if (window !== window.top) {
return Ox.Message.post.apply(this, arguments);
}
}; };
that.triggerMessage = function() { that.triggerMessage = function() {
@ -272,18 +274,19 @@
// posting to parent, but not yet initialized // posting to parent, but not yet initialized
setTimeout(function() { setTimeout(function() {
that.post.apply(Ox.parent, args); that.post.apply(Ox.parent, args);
}, 25); }, 250);
} else {
Ox.forEach(
Ox.makeObject(Ox.slice(args)),
function(data, event) {
target.postMessage(JSON.stringify({
data: data,
event: event,
target: isParent ? Ox.oxid : null
}), '*');
}
);
} }
Ox.forEach(
Ox.makeObject(Ox.slice(args)),
function(data, event) {
target.postMessage(JSON.stringify({
data: data,
event: event,
target: isParent ? Ox.oxid : null
}), '*');
}
);
}; };
that.trigger = function(self) { that.trigger = function(self) {