41 lines
1009 B
HTML
41 lines
1009 B
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Iframe Communication</title>
|
|
</head>
|
|
<body>
|
|
|
|
<iframe name="frame" width="1000" height="1000"></iframe>
|
|
|
|
<script>
|
|
window.open("iframe.html", "frame");
|
|
|
|
const windowProperties = {
|
|
title: "Test Window",
|
|
headerMessage: "Header Message",
|
|
icon: "image.png",
|
|
resizable: true,
|
|
size: {width: 500, height: 600},
|
|
minSize: {width: 500, height: 600},
|
|
position: {x: 50, y: 200},
|
|
htmlWindowRef: undefined,
|
|
htmlContentRef: undefined,
|
|
windowRef: undefined,
|
|
headerActions: [],
|
|
windowType: undefined,
|
|
dialog: {open: false},
|
|
};
|
|
|
|
window.onload = () => {
|
|
const frame = document.querySelector("iframe");
|
|
frame.contentWindow.postMessage(windowProperties, location.origin); // Iframe Origin
|
|
};
|
|
|
|
window.addEventListener('message', (event) => {
|
|
console.log(event);
|
|
}, false);
|
|
</script>
|
|
|
|
</body>
|
|
</html> |