dont send messages if not an iframe
This commit is contained in:
parent
4a2751839f
commit
baeeff366e
1 changed files with 15 additions and 12 deletions
|
@ -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) {
|
||||||
|
|
Loading…
Reference in a new issue