Setting height on an embedded iFrame


(Damien Sirkis) #1

Embedded iframe seem to default to a fixed vertical size, probably because it doesn’t/can’t compute the height during the render of the iframe?

I’d like to set that height to something larger.

I’ve found this post documenting a similar issue but I’m not sure where his solution goes.


(Bar Smith) #2

I think that what you describe is exactly the issue.

I made that code run every time someone switched to the tab with the imbed of the discourse in it.

You can see my solution in action here:

http://maslowcommunitygarden.org/CNC-Cut-Dish-Rack.html


(Damien Sirkis) #3

Where does the code go? I’m on a hosting plan so I’m not sure if I have access to this or not.


(Bar Smith) #4

Take my advice with a grain of salt because this is the first thing I’ve ever done like this.

In the case of my page I put the code so that it would run when the tab was clicked. You can actually see a delay after the tab opens before the iframe resizes.

My guess is that you could put the code anywhere on the page if it is a static page, but I really don’t know


(Damien Sirkis) #5

I think this is where my relative noob status with Discourse is causing me to be dense :slight_smile:

What do you mean by ‘anywhere in the page’? I’m editing a post in this case, can you add JS to the content of the post? Or are you talking about some code in Discourse itself that generates the pages?


(Damien Sirkis) #6

Ping! Anyone from Discourse care to help out?