Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    Apr 2012
    Location
    St. Louis, MO
    Posts
    985
    Thanks
    7
    Thanked 101 Times in 101 Posts

    Question Same domain iframe resizing to content - IE and Chrome like it, FF does not

    Hello, everyone.

    I've got an iframe (same domain) that I'm resizing based upon content, and it's working great in IE (oddly) and Chrome, but not FireFox.

    Code:
    <iframe src="document.cfm" name="uploadToLS" onload="resizeIframe(this);"></iframe>
    
    <script type="text/javascript">
    function resizeIframe(ifrm){
      if(ifrm.contentWindow.document.body.scrollHeight){
        ifrm.style.height = ifrm.contentWindow.document.body.scrollHeight + "px";
      }
      else{
        ifrm.style.height = ifrm.contentDocument.documentElement.scrollHeight + "px";
      }
    }
    </script>
    IE 8 and Chrome work; FireFox just sizes to ~200px height, no matter what is on the page. I've tried Google-ing for this and I'm not seeing anything different from what I've got. Thoughts?

    Thank you,
    Last edited by WolfShade; 03-20-2013 at 10:01 PM.
    ^_^

    If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
    *
    The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".

  • #2
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,273
    Thanks
    10
    Thanked 581 Times in 562 Posts
    Quote Originally Posted by mrhoo View Post
    ifrm.style.cssText=
    not xbrowser, use ifrm.setAttribute("style", ...) instead
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%

  • #3
    Regular Coder
    Join Date
    Apr 2012
    Location
    St. Louis, MO
    Posts
    985
    Thanks
    7
    Thanked 101 Times in 101 Posts
    Thanks for the reply, mrhoo. I'm trying as you suggest, but it still isn't working.

    What I did discover: By using alerts, I can see that IE is reporting the correct pixel height of 738; but FF is reporting 150. So, I guess that it's sizing it right as it sees it; it just has the wrong value.

    ??
    ^_^

    If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
    *
    The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".

  • #4
    Regular Coder
    Join Date
    Apr 2012
    Location
    St. Louis, MO
    Posts
    985
    Thanks
    7
    Thanked 101 Times in 101 Posts
    @rnd me: I just noticed your suggestion after I hit the submit. I'll give that a shot and see if it works. Thanks!

    EDIT: Okay.. long day.. same thing (duh).. FF is getting an incorrect value, for some reason.
    Last edited by WolfShade; 03-20-2013 at 07:47 PM.
    ^_^

    If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
    *
    The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".

  • #5
    Regular Coder
    Join Date
    Apr 2012
    Location
    St. Louis, MO
    Posts
    985
    Thanks
    7
    Thanked 101 Times in 101 Posts
    Even if I give it a setTimeout of 300ms or 3000ms, still reporting a height of 150px.
    ^_^

    If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
    *
    The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".

  • #6
    Regular Coder
    Join Date
    Apr 2012
    Location
    St. Louis, MO
    Posts
    985
    Thanks
    7
    Thanked 101 Times in 101 Posts
    In the document that the iframe loads, I had set height:100%; in the CSS. When I removed it, it worked as expected.
    ^_^

    If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
    *
    The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •