Jump to content

resize an iframe

Recommended Posts

Just now, Mylene said:

Hey everyone 

I wonder if someone has a solution for resizing an iframe depending on size of content.

I have an html datapage and need to deploy submission form in iframe and I'd like to avoid scrolling


I have a solution for your case. You may find code below:


  function resizeIframe(obj) {
    obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';

<iframe  src="URL_of the datapage" frameBorder="0" scrolling="no" width=100% onload="resizeIframe(this)">Sorry, but your browser does not support frames.</iframe>


Don't forget to insert your URL instead of: URL_of the datapage

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...