• Resolved phoros

    (@phoros)


    I spent many hours to find a working (!) solution so I hope someone can follow this.

    It works only in the same domain!

    I have a standalone guestbook (working here) alongside my WP website.

    Initially I made a custom page template and put it in an iframe there. Of course I didn’t want to any scrollbars so I set height and width safely to avoid them. But there were big differences in height of the guestbook pages and it looked weirdly with few short entries in the guestbook and a huge WP page (height=”1400px”).

    I tested several ideas, many js scripts and CSS tricks. And finally found this pretty old script.

    And here we are.

    I only had to add some pixels for FF to make scrollbars disappear:
    var FFextraHeight=parseFloat(getFFVersion)>=0.1? 22 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers

    Tested in Chrome 15.0.874.106, FF 7.0.1 & IE 9.0.8112.16421 (hope it works in other versions/browsers too).

    BTW I’ve resigned from a custom page template and forced WP editor to ‘buy’ iframes with adding this to functions.php:

    add_filter('tiny_mce_before_init', create_function( '$a',
    '$a["extended_valid_elements"] = "iframe[id|class|title|style|align|frameborder|height|longdesc|marginheight|marginwidth|name|scrolling|src|width]"; return $a;') );

    Cheers from Poland!

  • The topic ‘Iframe with auto height in page/post’ is closed to new replies.