genia.likes.science@gmail.com | c5f82a2 | 2013-05-08 02:44:35 -0700 | [diff] [blame^] | 1 | <!doctype html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <title>easyXDM</title> |
| 5 | <script type="text/javascript"> |
| 6 | var target = location.hash.substring(1); |
| 7 | |
| 8 | var host = window.opener.frames[target]; |
| 9 | |
| 10 | if (window.opener) { |
| 11 | try { |
| 12 | // test if we have access to the document |
| 13 | if (window.opener.document.title) { |
| 14 | host = window.opener; |
| 15 | } |
| 16 | |
| 17 | } |
| 18 | catch (xDomainError) { |
| 19 | // we have an opener, but it's not on our domain, |
| 20 | host = window.opener.frames[target]; |
| 21 | } |
| 22 | |
| 23 | if (host) { |
| 24 | try { |
| 25 | host.setApp(window); |
| 26 | } |
| 27 | catch (browserHostError) { |
| 28 | alert("was unable to gain a reference to the iframe"); |
| 29 | } |
| 30 | } |
| 31 | } |
| 32 | </script> |
| 33 | </head> |
| 34 | <body> |
| 35 | <!-- Send some data to the other side using the proxy --><input type="button" onclick="host.sendData({a:'b',c:'d',e:'f'});" value="send data to local"/> |
| 36 | </body> |
| 37 | </html> |