Welcome to Geeklog, Anonymous Monday, June 17 2024 @ 12:08 pm EDT

Dynamic Resizable iFrame Solution Release Candidate 1

  • Thursday, February 13 2003 @ 11:03 am EST
  • Contributed by:
  • Views: 65,132
Announcements This should help your iframes dynamically resize on every new page load... Don't go crazy :)

<!-- Please Do Not Remove or Modify This Comment
If you can add an improvement or enhancement to this script you're 1000% free to go ahead with it, just please
send your updates to vbgunz about your modifications to dexterslab@vbgunz.com... If you need the official script
you can try Geeklog for "dynamic resizable iframe" or email dexterslab@vbgunz.com for a copy.
// Please Do Not Remove or Modify This Comment-->

<!-- It is safe to remove this comment in production...
1a. Updates and modifications
1a. Introduction
2a. Thanks
3a. Geeklog installation instructions

1a. Introduction
This is a dynamic resizable iframe script... It resizes the iframe every time a new link within that iframe
is clicked... It works on IE6 and on Mozilla 1.2 and should work on Netscape 6+ browsers...

This script is only able to render iframes for the same domain or host... if localhost is hosting this script
it will only work calling in a localhost page... localhost cannot call or and vice versa.
Google has the better explaination at http://www.google.com/search?q=iframe%20cross%20domain%20script

2a. Thanks
Major thanks to Kenny9336 at http://www.experts-exchange.com for the constructing of over 99% of this script...
Major thanks to Creator over at http://www.geeklog.net for suggesting a most powerful enhanced improvement...
Major thanks to vbgunz for 3 days in modifying this script over at Dexter's lab dexterslab@vbgunz.com
Major thanks to gator4life at http://www.experts-exchange.com for the explaination of iframe cross scripting...

3a. Geeklog installation instructions
Login and go to your static page section... Paste this script into the window and only change the iframe
src="http://localhost/" value to match your domain and directory... http://yourdomain.com/directory... You can
also modify whether scrolling and scroll are to be yes and margin widths, etc...

That's it... Happy iframing :)

// It is safe to remove this comment in production...
<script language="JavaScript">
function iFrameHeight() {
if(document.getElementById && !(document.all)) {
h = document.getElementById('iframename').contentDocument.body.scrollHeight;
document.getElementById('iframename').style.height = h;
else if(document.all) {
h = document.frames('iframename').document.body.scrollHeight;
document.all.iframename.style.height = h;
<iframe onLoad="iFrameHeight();" src="http://localhost/" scrolling="no" scroll="no" id="iframename" marginwidth="0" marginheight="0" frameborder="0" style="width:100%;"></iframe>


Thanks Geeklog for the superb community and application ;)