Embedded Comments iframe Height Not Set

I am experiencing the exact same issue described here:

However I can see that a pull request has been merged to fix that issue (I double checked my capitalization anyway).

The issue is that my iframe height is not being set and seems to default to 150px

Which as you can see cuts off all but the first part of the first post. If I manually increase the iframe height I can see that all the rest of the posts are there, but hidden.

Can anyone point me in the right direction?

Thanks!

1 Like

To make the issue weirder, sometimes the iframe will load the correct size, but usually not :roll_eyes:

Edit:

I think I’ve got it somewhat figured out (not a solution, but at least what is going on).

Forgive me if this is obvious, I’ve never done anything like this before.

What happens is:

  1. Someone loads the page
  2. The iframe is generated on the Discourse side and the frame is somehow sized based on the space available
  3. Because I have my comments section in a tab, that page doesn’t exist until someone clicks on the tab the page doesn’t exist and the size is loaded wrong

I can repeatedly make the comments section show up more or less by loading a page, clicking on the comments section (size 150px), then refreshing the page and the comments section shows up the same size as the main Files tab, which changes from page to page…

Edit2: Right clicking and choosing “reload frame” will fix the issue

So what do I do from here?

I think I was able to find an answer.

I’m not sure if this is good practice, but I am just forcing the I frame to resize as recommended in this question:

When someone switches tabs the frame is automatically reset like this:

var ifr = document.getElementById('discourse-embed-frame');
ifr.src = ifr.src;

Thanks for letting me work through this, and I hope this is useful to someone else some day.

Please let me know if this is bad practice.

1 Like