Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Dynamic Iframe Height Script Help.

  1. #1
    Join Date
    Nov 2007
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Dynamic Iframe Height Script Help.

    1) Script Title: Iframe SSI Script II

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...iframessi2.htm

    3) Describe problem:

    My problem is that I entered this script into my forum.php page. The iframe does not resize automatically to the height desired.

    Can someone tell me if this script is working and/or how to fix it.

    my website is: www.ggcorner.info
    the forum iframe page is: www.ggcorner.info/forum.php

    thanks.

  2. #2
    Join Date
    Nov 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    The iframe height is defined in the js file and it must be possible to use styling of the class. I have tried many places and construction without succes.
    <style type="text/css">
    #iframe.tabcontentiframe {height:1000px}
    </style>

    I am sure that I am doing some wrong and hope that together with g0d that someone can tell us trhe missing link.

    Thank

  3. #3
    Join Date
    Nov 2007
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I added the script to my page with the iframe in it. It does not work.
    Is there anyone with ideas.

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I have an idea, the script you are talking about is finicky when it comes to the markup of both the top page (surrounding the iframe - if the iframe has a container that cannot shrink and grow along with it, like a table cell, certain divisions, etc.) and that of the imported page(s), absolute positioning can be bad, as well as anything (like floats, other dynamic content, etc.) that makes it unclear to the browser what the exact layout height of the page is, or if the page cannot wrap to the width of the iframe.

    Before I go into details, if you don't (as is often the case with forums) have a lot of control over the layout of the pages, find some other way to deal with the situation besides this script. The script doesn't work in Opera, and perhaps others, is only rated for IE and FF - and can be, as I say, finicky in those.
    Last edited by jscheuer1; 11-03-2007 at 06:04 AM. Reason: typo
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Nov 2007
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I added the script to the .php file using the iframe.
    I edited it appropriately to use my iframes name instead of myframe.
    What I am trying to do is integrate my forum into an iframe on my website.
    I have succesfully done this regarding width but I cannot find a way to set a dynamic height. This is where this script comes into play.

    Can someone please tell me what I am doing wrong / any other solution to make the integrated Iframe have a dynamic height?

    Thank you. Below is the code from my forum.php page regarding the iframe and the script..

    This is the script code in my file:
    Code:
    <script type="text/javascript">
    
    /***********************************************
    * IFrame SSI script II- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
    * Visit DynamicDrive.com for hundreds of original DHTML scripts
    * This notice must stay intact for legal use
    ***********************************************/
    
    //Input the IDs of the IFRAMES you wish to dynamically resize to match its content height:
    //Separate each ID with a comma. Examples: ["myframe1", "myframe2"] or ["myframe"] or [] for none:
    var iframeids=["forum"]
    
    //Should script hide iframe from browsers that don't support this script (non IE5+/NS6+ browsers. Recommended):
    var iframehide="yes"
    
    var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
    var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers
    
    function resizeCaller() {
    var dyniframe=new Array()
    for (i=0; i<iframeids.length; i++){
    if (document.getElementById)
    resizeIframe(iframeids[i])
    //reveal iframe for lower end browsers? (see var above):
    if ((document.all || document.getElementById) && iframehide=="no"){
    var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
    tempobj.style.display="block"
    }
    }
    }
    
    function resizeIframe(frameid){
    var currentfr=document.getElementById(frameid)
    if (currentfr && !window.opera){
    currentfr.style.display="block"
    if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
    currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight; 
    else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
    currentfr.height = currentfr.Document.body.scrollHeight;
    if (currentfr.addEventListener)
    currentfr.addEventListener("load", readjustIframe, false)
    else if (currentfr.attachEvent){
    currentfr.detachEvent("onload", readjustIframe) // Bug fix line
    currentfr.attachEvent("onload", readjustIframe)
    }
    }
    }
    
    function readjustIframe(loadevt) {
    var crossevt=(window.event)? event : loadevt
    var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
    if (iframeroot)
    resizeIframe(iframeroot.id);
    }
    
    function loadintoIframe(iframeid, url){
    if (document.getElementById)
    document.getElementById(iframeid).src=url
    }
    
    if (window.addEventListener)
    window.addEventListener("load", resizeCaller, false)
    else if (window.attachEvent)
    window.attachEvent("onload", resizeCaller)
    else
    window.onload=resizeCaller
    
    </script>
    This is the iframe code:
    Code:
    <td width="608" height="504" valign="top"><center><iframe onload="resize_iframe()" title="forum" id="forum" src="http://www.ggcorner.info/forum" scrolling="auto" frameborder="0" width="613" height="650"></iframe></center></td>

  6. #6
    Join Date
    Nov 2007
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    this is pathetic.
    obviously there is something faulty with your script and there is absolutely 0 effective support on this forum.
    is there no one here with any knowledge on this topic.

  7. #7
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Support here is completely based on volunteers who take time to help others.

    Getting upset and especially getting angry with us won't do much for your case.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  8. #8
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I might add that, personally I don't like the iframe resizing concept because it is so finicky, so it is low on my priority of scripts to help with. Having the person inquiring about it cop an attitude makes me even less inclined to bother with it, though I might get to it if I'm bored and there is little else to do in the forums here. Ajax is generally a better solution if resizing of the display area is required, but can be tricky with paths and scripts on the external pages. If one is willing to do the work, the path and script problems can be dealt with though. However, with an auto resizing iframe, getting it to size as desired isn't always compatible with a given design on the top and/or external page(s), and there can be other issues. It was the best that was available at one point for this type of thing, Ajax has changed that.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  9. #9
    Join Date
    Nov 2007
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I am not angry or upset I am just making a clearly observable comment based on the amount of support here.

    Is there any way to fix the current script and to get it to work?
    Or is there another alternative solution such as this Ajax thing and could you tell me how to pursue it

  10. #10
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Your mood is not transferred through your words; your tone is. Consider making them relate.

    The "amount of support here" is great. But in this instance, it isn't necessarily fixing the script in question, because it's boring, hard and not very compatible to begin with.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •