MyBB Community Forums

Full Version: Help with HTML: iframe
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hey it's me again,

a simple HTML question. I have my forum set up in an iframe on my website. However, I want the frame to stretch in length with the forum page itself so users don't have to scroll down the frame (because of the frame's limitations). Check it out at http://www.joinsigma.com/forums.html

Right now I gave the frame a static length (800 pixels I think), but that would only be temporary. If anyone can help, I'd love you forever.
Do you mean for example, when you view a post, you need to scroll down to see all the replies? cause if you want to stretch the iframe everytime this happens, i dont believe you can. The only option you can do to rectify this problem would be to use scrolling="auto" in the iframe code.
There's no way to make the frame automatically stretch to the length of the page? Is there a more advanced, php or css version of iframe? I will not surrender to scrollbars!!
Ok, try this

Admin CP > Templates > Template > Expand > htmldoctype

Replace
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

With
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

Admin CP > Templates > Template > Expand > Header Include

Add
<style type="text/css">
html, body {
margin:0;
padding:0;
}
p {
margin:0;
padding:10px;
}
</style>
<script type="text/javascript">
function setHeight(){
var theHeight=document['body'].offsetHeight;
parent.document.getElementById('content').height=theHeight;
}
</script>

Admin CP > Templates > Template > Expand > Index Templates > Index

Replace
<body>
With
<body onload="setHeight()">

Own site
<iframe name="content" id="content" frameborder="0" scrolling="no" src="content.html"></iframe>

I'm not sure what effect changing the doc type will have maybe someone from the MyBB team can advise, but this should resize the iframe automatically without scroll bars.
Okay well some problems. First I did everything you said and the frame loaded very small with me having to actually click it to load the forum. A ?> loaded at the top. Well, I tried to adjust the code in the headerinclude template and even though I reverted it back to the first way you showed me, now the frame doesn't load the webpage at all -- a 404 error. Solutions?
ok the reason it was small and didnt load was because you need to replace the content.html code with the url of your forums, sorry i missed that bit out.

<iframe name="content" id="content" frameborder="0" scrolling="no" src="content.html"></iframe>
The frame is still very small. I've double checked the code and did everything right. However, when checking my actual webpage hosting the iframe - there is an error mentioned at the bottom of IE.

The error says "Line 19, Char 1, Error: Access is denied, URL: http://forums.joinsigma.com/mybb/"

This might have something to do with why it won't adjust it's size?
I think the problem might be your using tables that have a fixed size so the iframe cannot resize itself as its inside a fixed table size
Any other suggestions? I've removed the limitations on all the tables not including the primary table that the forum MUST sit in seeing as it's the base of the template. The error I saw concerns me, it might be a minor infraction in the code.
Moved to Templates and Themes.
Pages: 1 2