T
Typebot5d ago
Paul

Automatically expanding an Embed block's height to fit its content

Hello everyone. I am wanting to display different pieces of HTML content retrieved using API calls, in Embed blocks. All of these HTML pieces are dynamically generated and there is no way to know in advance the size of the returned content. I want that the Embed block should automatically expand its height to fit its content so that no vertical scrollbar appears. The embed block has a Height parameter and I thought leaving this blank will result in what I want but this parameter requires a value. I also tried setting the Height parameter using a variable set to 'Auto' but this is not an accepted value and this causes the iframe in the embed block to be set to a default height of 400px. Is there some solution for what I want? Maybe some custom CSS targeting the iframes created by the Embed block can help or maybe some JavaScript in a Script block can adjust the height of all existing iframes on the page. I am not able to figure this out and would really appreciate some help with this matter for which I thank you in advance.
3 Replies
Paul
PaulOP5d ago
It would be great if someone can provide some help with this issue! Just to rephrase, I am wanting to display some HTML content returned by an external server in my chat and if using the Embed block is the only option, then I want that this block should vertically expand to fit its content so that no vertical scrollbars are displayed. Thanks in advance for any inputs that I receive!
Baptiste
Baptiste5d ago
It's a HTML limitation, we can't really know the size of an iframe content. Unfortunately we can't do anything about it
Paul
PaulOP4d ago
Thanks for your response, Baptiste! I see your point and my research on setting a height for an iframe also reached the same conclusion. I will try to figure out if I can use a Script block to adjust the height of the iframe once it is rendered by the Embed block. Also, thanks for providing all of us with a great product like Typebot!

Did you find this page helpful?