* msg updates
[lhc/web/wiklou.git] / js2 / mwEmbed / mwHostProxy.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2 "http://www.w3.org/TR/html4/loose.dtd">
3 <html>
4 <head>
5 <title></title>
6 <script type="text/javascript">
7 /*
8 XDCommsChild - Cross Domain Communication, Child Object.
9
10 Create this in the child window with the address of the xdomaincomms.html file on the same domain as the parent window
11 */
12 var XDCommsChild = function(xdomaincommsAddress) {
13 this.xdomaincommsAddress = xdomaincommsAddress;
14
15 this.isIe = isInternetExplorer();
16
17 if (isIe) {
18 // need hidden frame for communication. IE8 is supposed to support postMessage, but I can't get it to work properly
19 document.writeln("")
20 }
21
22 this.postBack = function(data) {
23 if (isIe) {
24 // this method tested against IE6,7 & 8
25 window.open(this.xdomaincommsAddress + '#data=' + data, 'xdcomms'); // MUST use window.open. frame.src or frame.location both fail
26 } else {
27 // for everything else - tested against Firefox 3, Chrome, Safari
28 window.opener.postMessage(data, '*'); // should really restrict the domain data can come from here
29 }
30 }
31
32 this.postBackAndCloseWindow = function(data){
33 this.postBack(data);
34 setTimeout("window.close()", 200); // need to use a timeout to make sure the javascript in the frame has executed if we are using that communication model
35 }
36 }
37 </script>
38 </head>
39 <body>
40 <h3> This file should be inclued by external sites that want to be proxied: </h3>
41 </body>
42 </html>
43