Window.name can also perform cross-domain data transfer.
Here is the corresponding code, evil.html read foo.html data across domains, where proxy.html and evil.html are in the same domain, with no content.
Evil.html:
<Scripttype= "Text/javascript"> varFlag= 0; variframe=Document.createelement ('iframe'); IFRAME.SRC= 'http://www.foo.com:8081/langtao/foo.html'; Document.body.appendChild (IFRAME); if(Iframe.addeventlistener) {Iframe.addeventlistener ('Load', Hadle,false); } Else{iframe.attachevent ('onload', Hadle); } functionHadle () {if(Flag===1) { varData=Iframe.contentWindow.name; //Read Dataalert (data); //Show cross-domain data //Cleanup WorkIframe.contentWindow.document.write ("'); Iframe.contentWindow.close (); Document.body.removeChild (IFRAME); } Else if(Flag=== 0) {flag= 1; Iframe.contentWindow.location= "http://www.evil.com:8081/langtao/proxy.html"; //set of proxy files, proxy.html and evil.html same domain } };</Script>
Foo.html:
<type= "Text/javascript"> window.name= ' I'm from foo'; // The name property can set or return a string that holds the name of the window, here is the data we want to transfer </ Script >
Cross-domain (vi)--window.name