-
Notifications
You must be signed in to change notification settings - Fork 8
/
child.html
34 lines (23 loc) · 887 Bytes
/
child.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
33
34
<html>
<head>
<title>backwards compatable postMessage demo</title>
<script src='postmessage.js'></script>
</head>
<body>
This page is hosted at joshfraser.com<br /><br />
<a href='#' onclick="send('one')">Send message "one" from child to parent</a><br />
<a href='#' onclick="send('two')">Send message "two" from child to parent</a>
<script type="text/javascript">
// Get the parent page URL as it was passed in, for browsers that don't support
// window.postMessage (this URL could be hard-coded).
var parent_url = decodeURIComponent(document.location.hash.replace(/^#/, ''));
function send(msg) {
XD.postMessage(msg, parent_url, parent);
return false;
}
XD.receiveMessage(function(message){
window.alert(message.data + " received on "+window.location.host);
}, 'http://onlineaspect.com');
</script>
</body>
</html>