Support » Plugins » Resizable Iframe in post

  • Resolved Jessevl


    Hi, I am trying to integrate a PHPBB forum into a wordpress page by using an iframe and a javascript that automatically resizes that iframe to the content’s hight. I put the javascript code in the header of the theme, I think I did that right. But I also have to put some javascript in the post, and I think that that is where it goes wrong.

    The code in the header:

    <script language="JavaScript">
    function iFrameHeight() {
    if(document.getElementById && !(document.all)) {
    h = document.getElementById('forumframe').contentDocument.body.scrollHeight;
    document.getElementById('forumframe').style.height = h;
    else if(document.all) {
    h = document.frames('forumframe').document.body.scrollHeight; = h;

    The code in the post:

    <iframe scrolling="no" width="800" frameBorder="0" src="" marginHeight="10" marginWidth="0" name="forumframe" border="0" title="forumframe" id="forumframe"></iframe>
    <script language="JavaScript"> setInterval("iFrameHeight()", 1000)</script>

    The script works fine except for when I use it within WordPress. To show you the problem, here’s my page:

    Thanks in advance

Viewing 8 replies - 1 through 8 (of 8 total)
  • Are you really putting that in the Page editor as “content”?

    I think you’d have a lot more success if you added it to a Page template instead.

    Check out the Pages information in the codex. In particular, see how to create your own Page Templates.

    I did, but I put it in as ‘code’ and the script really showed up in the final page, it wasn’t stripped by wordpress (you can check the link I posted and look at the source). Would making a template really make the difference? I mean, the code is there…

    also, I don’t know that much about making wordpress templates, how can I make it look just like a normal page. And how do I make it appear in the pages menu (including the current page effect)?

    You didn’t click the link I gave you. /sad face

    I’m sorry, I did, but didn’t believe it would give me the solution. I did make a page template now, but sadly it doesn’t work, try the link to my page in my first post. It just does the same thing as before, and it gives me a script error, something about permissions, but I don’t get that error when I run that script from a page without wordpress (

    Perhaps I assumed too much.

    To be more direct:

    Create a new Page template (again, follow directions at Pages). Add your iframe stuff IN the template file.

    Create a new Page in WordPress.
    Give it a title.
    Don’t give it any content.
    Select the template you just created.

    Perhaps I assumed too much.
    A mistake we all make too often 🙂

    That’s exactly what I did, like i said in my previous reply 😉 and it did not work.
    It looks like the script in the header.php isn’t loaded correctly because the script error disappears when I delete the function call from the Page template (but offcourse the script doesn’t work without)

    OK, I tried something else and I got a very weird result.
    I made another Page template and the only code it contains is a copy and paste of the page you can find here: , so that’s without the wordpress theme and stuff but just to look if it would work: it didn’t. I really don’t understand what’s wrong with it, when I open the source of the page wordpress generated (or actually did nothing to it, because there was no php in this simple Page) I really don’t see any difference with that of the test page from outside wordpress. I really don’t know what to do now…

    Edit: just found out that it has something to do with the subdomain were it’s in, when I place it in the main domain or forum subdomain, it does work. But I can’t do that so I’ll have to find something…

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Resizable Iframe in post’ is closed to new replies.