How can you make an iframe responsive when it is loading content from another domain? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can you make an iframe responsive when it is loading content from another domain?

The main problem is determining the height of the content displayed. Or is it possible to just determine if the iframe has scrollbars? If it is it's height could be dynamically changed until the scrollbars disappear.

8th Nov 2017, 1:09 PM
Alex Dobrin
Alex Dobrin - avatar
3 Answers
+ 3
Size of iframe its the same for anything in your website to do responsive
8th Nov 2017, 1:43 PM
Daniel
Daniel - avatar
+ 1
No it's not. The height of the iframe is not changing with the height of it's content as it does with a div (for example).
8th Nov 2017, 2:11 PM
Alex Dobrin
Alex Dobrin - avatar
+ 1
Seems it's just not possible to get the height of the content of the iframe if it comes from another domain. :( I was hopping for at least get the status of the scrollbars.
8th Nov 2017, 7:33 PM
Alex Dobrin
Alex Dobrin - avatar