what happens is that I have an iframe that brings results from a link, the width of the iframe will always be the same, but depending on the number of results the height of the iframe varies, so I would like to know how I can do to adjust the size of the iframe each time the results are displayed without having a scroll.
2
Answers
You didn’t provide source code and it’s difficult to realize what’s your problem.
However try this solution to make the iframe take the width and height of your browser.
ex :
css :
Html :
You have to do a copy and paste of the code because it cannot run in a snippet.
An iframe cannot set its own size, it is determined and controlled by the parent window. This is particularly important because an iframe’s source may be part of another domain. It would be a security risk to allow an external domain to control our domain. Read the postMessage documentation carefully to ensure proper message handling between frames –
parent.html
myframe.html