0

I'm trying to add an iframe to WordPress without scroll and not knowing the height.

What I have so far is: <iframe src="[url from different domain]" scrolling="no" style="width: 100%; height: 100%; border: none; overflow: hidden;"></iframe>

Unfortunately, this makes the iframe very small in height and only displays the first part.

Based on this answer, I've also tried adding the following inline JS: onload='javascript:(function(o){o.style.height=o.contentWindow.document.body.scrollHeight+"px";}(this));' but it gives a cross domain permission error.

I've tried adding inside DIVs and with other CSS attributes, but nothing works. The only way is to add a fixed height, which defeats the purpose.

NBajanca
  • 3,544
  • 3
  • 26
  • 53
  • Hi! Can you post the URL to inspect? – Uklove Nov 07 '19 at 16:36
  • 1
    If the iframe content is loaded from the same domain you can use the techniques shown in the duplicate question. If it is loaded from a different domain, there is nothing you can do other than set a fixed height. – Turnip Nov 07 '19 at 16:41
  • @Turnip the iframe is from a different domain. I guess you're correct.. – NBajanca Nov 07 '19 at 17:21

0 Answers0