Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 5 of 5
  1. #1
    Join Date
    May 2007
    Location
    Brisbane, Australia
    Posts
    796
    Tokens
    0

    Default Expandable iframes (Urgent)

    Hey im using expandable iframes on my site but the probleam is they dont expand on IE only FF

    My code is:

    HTML Code:
    <script>
    
    var iframeids=["contents" , "say" , "player2"]
    var iframehide="yes"
    var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
    var FFextraHeight=parseFloat(getFFVersion)>=0.1? 47 : 0
    /*
    Internet explorer seems to think it can make it's own rules about the internet.
    */
    function resizeCaller() {
    var dyniframe=new Array()
    for (i=0; i<iframeids.length; i++){
    if (document.getElementById)
    resizeIframe(iframeids[i])
    //reveal iframe for lower end browsers? (see var above):
    if ((document.all || document.getElementById) && iframehide=="no"){
    var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
    tempobj.style.display="block"
    }
    }
    }
    
    function resizeIframe(frameid){
    var currentfr=document.getElementById(frameid)
    if (currentfr && !window.opera){
    currentfr.style.display="block"
    if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
    currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight; 
    else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
    currentfr.height = currentfr.Document.body.scrollHeight;
    if (currentfr.addEventListener)
    currentfr.addEventListener("load", readjustIframe, false)
    else if (currentfr.attachEvent){
    currentfr.detachEvent("onload", readjustIframe) // Bug fix line
    currentfr.attachEvent("onload", readjustIframe)
    }
    }
    }
    
    function readjustIframe(loadevt) {
    var crossevt=(window.event)? event : loadevt
    var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
    if (iframeroot)
    resizeIframe(iframeroot.id);
    }
    
    function loadintoIframe(iframeid, url){
    if (document.getElementById)
    document.getElementById(iframeid).src=url
    }
    
    if (window.addEventListener)
    window.addEventListener("load", resizeCaller, false)
    else if (window.attachEvent)
    window.attachEvent("onload", resizeCaller)
    else
    window.onload=resizeCaller
    </script>
    MY Link is:
    HTML Code:
    <a target="contents" href="community.php" style="text-decoration: none">
            <font color="#FFFFFF">Community</font></a>
    My iframe is:
    HTML Code:
    <iframe src="http://simplyhabbo.com/hx/simplyhabbohome.php" width="100%" id="contents" marginwidth="1" marginheight="1" name="contents" scrolling="no" border="0" frameborder="0" allowtransparency="yes"></iframe>
    Thanks,
    Chris
    Free Image Uploading

    __________________


    [/url]

    [/FONT]

  2. #2
    Join Date
    Mar 2008
    Location
    Swindon, UK
    Posts
    1,274
    Tokens
    187
    Habbo
    :Ltd

    Latest Awards:

    Default

    Theres something called a search button, "http://www.habboxforum.com/showthread.php?t=485016&highlight=expandable+ifram es", Theres a result to help you.

    Hi, names James. I am a web developer.

  3. #3
    Join Date
    Nov 2007
    Location
    London
    Posts
    1,577
    Tokens
    36

    Latest Awards:

    Default

    This problem tends to be a problem with the page you want to show in the iframe rather than the code. So check there are no stupid errors that IE might be picking up.

    Also, you can use these codes for your iframe:

    Code:
    <script type="text/javascript">
                //<![CDATA[
                window.onload = function() {
                    var f = document.getElementById("main");
                    function resize() {
                        var h = "";
                        var w = "";
                        if (f.contentDocument) {
                            h = f.contentDocument.documentElement.offsetHeight + 20 + "px";
                            // can't find anything for Opera and Firefox that works for the width. OffetWidth doesn't work right either.(f.contentDocument.documentElement,"").getPropertyValue("width");
                        } else if (f.contentWindow) {
                            h = f.contentWindow.document.body.scrollHeight + 5 + "px";
                        } else {
                            return;
                        }
                        f.setAttribute("height",h);
                        f.parentNode.setAttribute("height",h);
                    }
                    if (window.addEventListener) {
                        f.onload = resize;
                    } else if (f.attachEvent) {
                        f.attachEvent("onload", resize);
                    } else {
                        return;
                    }
                    resize();
                }
                //]]>
            </script>
    That's to go in your <head> tags on the main page.

    And this is your iframe:

    Code:
    <iframe name="main" id="main" src="home.html" width="556" frameborder="0" allowtransparency="yes" scrolling="no" ></iframe>
    Kind Regards,

    Guy
    __________________

    Since 2007. Unbelievable Uptime. Web hosting, resellers, master resellers, linux VPS, windows VPS, shoutcasts, at the lowest prices on the net.
    Tech-Hosts.co.uk.


  4. #4
    Join Date
    Dec 2007
    Posts
    1,683
    Tokens
    0

    Latest Awards:

    Default

    Oh, what a shame.

    I hate iframes anyway.

    On topic post: iUnknown I've seen that code on HFFM.

  5. #5
    Join Date
    Nov 2007
    Location
    London
    Posts
    1,577
    Tokens
    36

    Latest Awards:

    Default

    Quote Originally Posted by Independent View Post
    Oh, what a shame.

    I hate iframes anyway.

    On topic post: iUnknown I've seen that code on HFFM.
    Yeah it's on loads of websites, it's a free code.
    Kind Regards,

    Guy
    __________________

    Since 2007. Unbelievable Uptime. Web hosting, resellers, master resellers, linux VPS, windows VPS, shoutcasts, at the lowest prices on the net.
    Tech-Hosts.co.uk.


Posting Permissions

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