This commit is contained in:
parent
c95ba78682
commit
ca8c012581
|
@ -1,23 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<script>
|
||||
let iframe = document.Get
|
||||
window.addEventListener('message', function(event) {
|
||||
var message = event.data;
|
||||
|
||||
if (message && message.header && message.body) {
|
||||
if (message.header === 'head') {
|
||||
console.log("head" + message.body);
|
||||
} else if (message.header === 'body') {
|
||||
console.log("body" + message.body);
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<iframe src="about:blank" id="markdown-frame" style="width: 100%; height: 100%; border: none;"></iframe>
|
||||
</body>
|
|
@ -1,27 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>iFrame Container</title>
|
||||
</head>
|
||||
<body>
|
||||
<iframe style="width: 100%; height: 100%; border: none;" id="messageContainer" sandbox="allow-same-origin allow-scripts"></iframe>
|
||||
|
||||
<script>
|
||||
function receiveMessage(event) {
|
||||
if (event.origin !== location.origin) {
|
||||
return;
|
||||
}
|
||||
|
||||
document.getElementById('messageContainer').contentWindow.document;
|
||||
iframeDocument.open();
|
||||
iframeDocument.write(event.data);
|
||||
iframeDocument.close();
|
||||
}
|
||||
|
||||
// Listen for messages from the parent window
|
||||
window.addEventListener('message', receiveMessage, false);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue