Cause
For example, if Domain A has a page in Domain B, but the length of the page in Domain B is unknown, a cannot set an accurate height.
PS: the IFRAME height setting auto is invalid.
Solution
For example,
(1) Add an IFRAME
PS: the innermost a page can call the method of the outermost a page, while the B page cannot call the outermost a page (because of the security restrictions of cross-origin ).
(2nd) When page B is complete, modify Src in the IFRAME where agent.html of.
SetTimeout (function () {VaR _ Height = $ ("# vs-source "). height (); var B _iframe = document. getelementbyid ("crossdomain_agent_iframe"); // iframe id of agent.html if (B _iframe) {var src = B _iframe.src.split ("#") [0]; src = SRC. split ("? ") [0]; B _iframe.src = SRC + "? "+ New date (). gettime () +" # "+ (B _height + (_ height-1000 ));}
},200 );
(3366agent.html Code call the code of the outermost layer a page to set the height of the B page
The agent.html code is as follows:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Disadvantages
1. Modify page B, add an IFRAME, and set it automatically.
PS: in many cases, page B is a third-party page, which cannot be done either.
Set the height of the Cross-origin IFRAME