javascript - Page nested iframe height setting problem
世界只因有你
世界只因有你 2017-05-19 10:26:37
0
3
796

The page iframe is embedded in a third-party page.
How to set the height of this iframe to eliminate the scroll bar?
Because it is cross-domain, the document of the iframe cannot be obtained. Is there any other way?

世界只因有你
世界只因有你

reply all(3)
PHPzhong

Unless you can add code in a third-party iframe, it won’t work.

If you can add code, it will inform the parent page height through various cross-domain iframe communication methods.

迷茫
 1. document.getElementById('ifr').contentDocument; 
 2. document.getElementById('ifr').contentWindow.document; 
 3. window.frames[0].document; 

Some information on the Internet states that contentWindow is only valid for IE, and contentDocument is only valid for non-IE browsers. However, after my testing, these two methods are valid for current mainstream browsers (ie, firefox, chrome, safari, opera). )

習慣沉默

/a/11...

See if this article helps

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template