Jump to:

5540 Posts in 1738 Topics by 1224 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Auto resizing iframe

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 835 Views
  • SerenityIT
    Community Member
    13 Posts

    Auto resizing iframe Link to this post

    Hi guys,

    I'm trying to implement an auto resizing iframe into a page, but it requires to bits of script.

    First bit (which I stuck in Page.ss):

    <script language="JavaScript">
    function autoResize(id){
    var newheight;
    var newwidth;

    newheight=document.getElementById(id).contentWindow.document .body.scrollHeight;
    newwidth=document.getElementById(id).contentWindow.document .body.scrollWidth;

    document.getElementById(id).height= (newheight) + "px";
    document.getElementById(id).width= (newwidth) + "px";

    And the second bit:

    <IFRAME SRC="../helpdesk" width="100%" height="200px" id="iframe1" marginheight="0" frameborder="0" onLoad="autoResize('iframe1');"> </iframe>

    Now the problem I run into, is the fact the CMS html editor strips out the onLoad="autoResize('iframe1'); bit from the code.

    Plus on top of that, its a bit of a messy way to do it anyway as the top java loads on every page.

    Any ideas on how I can successfully implement it? Otherwise I'll go back to my other idea of stripping the already loaded html code from the browser and building a page around that (resulting in my navigation not updating)

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.