Initial
This commit is contained in:
55
index.html
Normal file
55
index.html
Normal file
@ -0,0 +1,55 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Parent document</title>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css">
|
||||
|
||||
<style>
|
||||
body {
|
||||
background-color: whitesmoke;
|
||||
font-family: Arial, sans-serif;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hello world</h1>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<h4 class="text-end">Left</h4>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<iframe src="child.html" id="child-container" height="200px" class="w-100"></iframe>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<h4>Right</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<script>
|
||||
window.addEventListener("message", function (event) {
|
||||
switch (event.data.cmd) {
|
||||
case "setHeight":
|
||||
// optionally check event.origin for security
|
||||
document.getElementById("child-container").style.height = event.data.iframeHeight + "px";
|
||||
break;
|
||||
case "openUrl":
|
||||
// optionally check event.origin for security
|
||||
window.location.href = event.data.url;
|
||||
break;
|
||||
default:
|
||||
console.warn("Unknown command received:", event.data.cmd);
|
||||
}
|
||||
});
|
||||
|
||||
window.addEventListener("load", function () {
|
||||
});
|
||||
</script>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user