We all know that JS has a homologous strategy, that is, the main domain name of different nested IFRAME does not allow JS communication.
For example, I have a website where I want to embed the page of its website. Then I can use an IFRAME to refer to the address of a third party website.
But the problem also comes to the height of the iframe is fixed can not be a good fusion with third-party sites, such as third-party sites using waterfall flow plug-ins, to scroll load automatic calculation height, then say cross-domain: IFrame main domain name different Cross-domain method, if the website a.com b.com A Inside put an IFRAME reference B.Com, in this case b.com inside of JS is inaccessible to a.com. JS cross domain must be homologous, is the same main domain name, that swollen mody do?
We can introduce an IFRAME in the B.Com, let's call it a C bar this iframe loads a Web page in a.com. This homology will have the B.Com in the IFRAME in the Web page can and a.com communication. Below as long as the B and C communication, so that C and a communication on the completion of b->a communication, so when the B height changes notify C, let C notice a to the height of the iframe adjustment.
B and C communication, in fact, through the URL address can achieve communication, B.Com iframe set to hide, change the SRC address when C can receive.
Nonsense don't say the code on
A.com/index.html
B.com/index.html
C Proxy file
<script> var search = window.location.search, Getsearchparam = function (search, key
{var mc = Search.match (New RegExp (Key + = ([^\&]*))), ret= "";
MC && mc.length && (ret = mc[0].replace (key + "=", ""));
return ret; },//Parameter H = getsearchparam (search, "H"), Ifmid = Getsearchparam (Search, "Ifmid"), CBN = Getsearchparam (search, "CBN"),// Wide High MH = Getsearchparam (Search, "MH") | | H, isfunction = function (FN) {return!! fn &&!fn.nodename && fn.constructor!= String && fn.constructor!= RegExp && fn.co
Nstructor!= Array && (/function/i). Test (fn + "");
try{if (parent && parent.parent) {IFM = Parent.parent.document.getElementById (Ifmid);
IFM && MH && (IFM.HEIGHT=MH);
FN=PARENT.PARENT[CBN];
Isfunction (FN) && fn.call ();
Ifm=null;
}}catch (ex) {Console.log (ex);} </script>