OLD | NEW |
1 <html> | 1 <html> |
2 | 2 |
3 <head><title>Post message tests</title> | 3 <head><title>Post message tests</title> |
4 <script> | 4 <script> |
5 // Send a message to our opener, and it will reply. | 5 // Send a message to our opener, and it will reply. |
6 function postToOpener(msg, origin) { | 6 function postToOpener(msg, origin) { |
7 window.opener.postMessage(msg, origin); | 7 window.opener.postMessage(msg, origin); |
8 return true; | 8 return true; |
9 } | 9 } |
10 | 10 |
| 11 // Send a message to our opener's opener. |
| 12 function postToOpenerOfOpener(msg, origin) { |
| 13 window.opener.opener.postMessage(msg, origin); |
| 14 return true; |
| 15 } |
| 16 |
11 // Send a message to a window named "foo". | 17 // Send a message to a window named "foo". |
12 function postToFoo(msg) { | 18 function postToFoo(msg) { |
13 var w = window.open("", "foo"); | 19 var w = window.open("", "foo"); |
14 w.postMessage(msg, "*"); | 20 w.postMessage(msg, "*"); |
15 return true; | 21 return true; |
16 } | 22 } |
17 | 23 |
18 function openPopup(url) { | 24 function openPopup(url) { |
19 popup = window.open(url); | 25 popup = window.open(url); |
20 } | 26 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 // Change the title to generate a notification. | 77 // Change the title to generate a notification. |
72 document.title = event.data.message; | 78 document.title = event.data.message; |
73 } else { | 79 } else { |
74 document.title = event.data; | 80 document.title = event.data; |
75 } | 81 } |
76 } | 82 } |
77 </script> | 83 </script> |
78 </head> | 84 </head> |
79 | 85 |
80 </html> | 86 </html> |
OLD | NEW |