Skip to content

Commit d695a3d

Browse files
authored
check for contained element with frameElement
1 parent 49363a8 commit d695a3d

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/IFrameWindow.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,12 @@ export class IFrameWindow {
105105

106106
static notifyParent(url) {
107107
Log.debug("IFrameWindow.notifyParent");
108-
109-
url = url || window.location.href;
110-
if (url) {
111-
Log.debug("IFrameWindow.notifyParent: posting url message to parent");
112-
window.parent.postMessage(url, location.protocol + "//" + location.host);
108+
if (window.frameElement) {
109+
url = url || window.location.href;
110+
if (url) {
111+
Log.debug("IFrameWindow.notifyParent: posting url message to parent");
112+
window.parent.postMessage(url, location.protocol + "//" + location.host);
113+
}
113114
}
114115
}
115116
}

0 commit comments

Comments
 (0)