Resize Iframe Height with Javascript


/ Published in: JavaScript
Save to your folder(s)

Resize iframe height. This means if the content of your iframe is longer than the iframe height, and the iframe doesn't have a scrollbar, you can resize the height of the iframe so the content is viewed.


Copy this code and paste it in your HTML
  1. //set the document domain
  2. document.domain = 'xxxx.com';
  3.  
  4. //resize the iframe
  5. function parent_resize()
  6. {
  7. parent.resize_iframe("idofiframe", document.getElementById('wrapper').offsetHeight);
  8. }
  9.  
  10. <body onload="parent_resize();">
  11. <div id="wrapper">
  12. .....
  13. </div>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.