| 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. | 11 // Send a message to our opener's opener. |
| 12 function postToOpenerOfOpener(msg, origin) { | 12 function postToOpenerOfOpener(msg, origin) { |
| 13 window.opener.opener.postMessage(msg, origin); | 13 window.opener.opener.postMessage(msg, origin); |
| 14 return true; | 14 return true; |
| 15 } | 15 } |
| 16 | 16 |
| 17 // Send a message to our parent's opener. | 17 // Send a message to our parent's opener. |
| 18 function postToOpenerOfParent(msg, origin) { | 18 function postToOpenerOfParent(msg, origin) { |
| 19 parent.opener.postMessage(msg, origin); | 19 parent.opener.postMessage(msg, origin); |
| 20 return true; | 20 return true; |
| 21 } | 21 } |
| 22 | 22 |
| 23 // Send a message to our parent's opener. |
| 24 function postToOpenerOfSibling(siblingName, msg, origin) { |
| 25 parent.frames[siblingName].opener.postMessage(msg, origin); |
| 26 return true; |
| 27 } |
| 28 |
| 23 // Send a message to a window named "foo". | 29 // Send a message to a window named "foo". |
| 24 function postToFoo(msg) { | 30 function postToFoo(msg) { |
| 25 var w = window.open("", "foo"); | 31 var w = window.open("", "foo"); |
| 26 w.postMessage(msg, "*"); | 32 w.postMessage(msg, "*"); |
| 27 return true; | 33 return true; |
| 28 } | 34 } |
| 29 | 35 |
| 30 function openPopup(url) { | 36 function openPopup(url) { |
| 31 popup = window.open(url); | 37 popup = window.open(url); |
| 32 } | 38 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 // Change the title to generate a notification. | 89 // Change the title to generate a notification. |
| 84 document.title = event.data.message; | 90 document.title = event.data.message; |
| 85 } else { | 91 } else { |
| 86 document.title = event.data; | 92 document.title = event.data; |
| 87 } | 93 } |
| 88 } | 94 } |
| 89 </script> | 95 </script> |
| 90 </head> | 96 </head> |
| 91 | 97 |
| 92 </html> | 98 </html> |
| OLD | NEW |