iframe width problem in IE

Discussion in 'HTML & Website Design' started by bspisak, Jul 11, 2008.

  1. #1
    I'm using an iframe to pull content from my own server. The iframe width is set to 100% but it is getting cut off on the right side when I view in IE6. FireFox3 and Safari are fine.

    When I use the following javascript onload to get variable height, the width comes up fine, but if click on an embedded link that reloads the page, the width gets messed up again. (Btw, this is Joomla code if anyone recognizes it.)

    
    function iFrameHeight() {
      var h = 0;
      if ( !document.all ) {
        h = document.getElementById('blockrandom').contentDocument.height;
        document.getElementById('blockrandom').style.height = h + 60 + 'px';
      } else if( document.all ) {  
        h = document.frames('blockrandom').document.body.scrollHeight;
        document.all.blockrandom.style.height = h + 20 + 'px';}
    }
    Code (markup):
    I can fix that by modifying the code to use something I found in a MS KB article (//support.microsoft.com/kb/278469).

    
    function iFrameHeight() {
      var h = 0;
      if ( !document.all ) {
        h = document.getElementById('blockrandom').contentDocument.height;
        document.getElementById('blockrandom').style.height = h + 60 + 'px';
      } else if( document.all ) {  
        var oBody = blockrandom.document.body;
        var oFrame = document.all("blockrandom");
        oFrame.style.height = oBody.scrollHeight + (oBody.offsetHeight - oBody.clientHeight);
        oFrame.style.width = oBody.scrollWidth + (oBody.offsetWidth - oBody.clientWidth);
    }
    Code (markup):
    However, now the problem is that when I resize the window, it doesn't change the width and the frame overruns other parts of my page.

    Blarg! :mad:

    Does someone have a clean solution for this?
     
    bspisak, Jul 11, 2008 IP
  2. bspisak

    bspisak Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Still hoping someone can help answer this question for me. Anyone?
     
    bspisak, Jul 14, 2008 IP
  3. ramijames

    ramijames Member

    Messages:
    91
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    48
    #3
    i'm curious, why are you using an iframe and not loading content from your server into a div as an include? that way the height of the div is rendered according to the content as the page itself is rendered.
     
    ramijames, Jul 15, 2008 IP
  4. bspisak

    bspisak Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    The content I'm referring to is phpBB, the whole application. I want it to appear embedded in my CMS.
     
    bspisak, Jul 15, 2008 IP
  5. ramijames

    ramijames Member

    Messages:
    91
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    48
    #5
    ah, i understand.

    it seems to me that this is what you are looking for:
    dynamicdrive.com/dynamicindex17/iframessi2.htm

    (sorry for the whacko looking link. still can't post links here. still my first week.)
     
    ramijames, Jul 15, 2008 IP
  6. tangletail

    tangletail Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    um would it be easyer to use a php file tag with read only permisions
     
    tangletail, Dec 18, 2008 IP