-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
32 lines (30 loc) · 1.02 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
background: #ccc;
}
iframe {
display: block;
margin: 100px auto 0 auto;
border: 1px solid black;
height: 500px;
width: 400px;
}
</style>
</head>
<body>
<iframe src="https://enke.to/i/widgets?parentWindowOrigin=http%3A%2F%2Fenketo.github.io"></iframe>
<script>
window.addEventListener("message", receiveMessage, false);
function receiveMessage(event)
{
// TODO in real life, check origin! if (event.origin !== "http://enk.to:8080") return;
console.log('data received from iframe', JSON.parse(event.data));
console.log('origin of message', event.origin);
console.log('source of message', event.source);
}
</script>
</body>
</html>