Initial commit
This commit is contained in:
41
HTML/IframeCommunication/index.html
Normal file
41
HTML/IframeCommunication/index.html
Normal file
@@ -0,0 +1,41 @@
|
||||
<!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>
|
||||
Reference in New Issue
Block a user