Heroes, how to make the IFRAME adaptive content height? I searched many programs on the Internet, but none of them worked. What to do? Who has a good idea?
My example is very simple, a blank page, referring to Sohu's homepage, how the framework adaptive height?
I'm just trying to give an example, not hotlinking. Thank you.
Reply to discussion (solution)
You find a lot of answers, try again, change the address of the IFRAME to the same directory as this page.
That is, you write an iframe in 1.html, open 2.html, and write content in 2.html. At the very least, two files are your own and the same domain name can be accessed.
Try to find the answer again.
Not to write your code, only to provide ideas. Because Sohu's page height is unpredictable, so you have to be in the parent page with JS to check the content height of the sub-page (Sohu) (simple point, the height of the document should be detected), once found that the height changes in the parent page with JS to adjust the height of the IFRAME, Generally according to the user's network delay may be three or four seconds Sohu's page should be fully loaded, and your height here is basically constant down
I'm still out of the question, and the problem is probably hard to solve.
1, modify the height of the ifame need to use JS, I believe you have found the code
2. JS cannot manipulate cross-domain controls. You are not Sohu, obviously the IFRAME in the cross-domain Sohu, so the modification failed
3, you have to turn Sohu from cross-domain to non-cross-domain, and then to achieve your purpose
4, PHP has provided a means to obtain remote data (including Web pages), you only need to apply flexibly.
Very clear, that is the 4th, I will learn how to do.