Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • ergcreative Friend
    #202423

    Hi,

    I need help to implement iFrame cross-domain on JA_DECOR and under Joomla 3.3.6.

    I need to display iFrame with “Auto Height” or “Auto Resize” after filled-form been button-clicked.

    iFrame being used with javascript like below (this just example one from few tried from my script) – result always cut after 500px:

    <html>
    <body>
    <div style=”margin:0px;”>
    <iframe style=”align:middle; border:1px solid #666 border-radius:0px; margin-left:0px; padding:0px;”
    src=”http://www.otherpage.com”
    width=”100%” scrolling=”auto” onload=”callback”></iframe>
    </div>
    <p id=”callback”>
    </p>

    <script type=”text/javascript”>

    function autoResize(callback){ var newheight; var newwidth;
    if(document.getElementById){
    newheight=document.getElementById(callback).contentWindow.document.body.scrollHeight;
    newwidth=document.getElementById(callback).contentWindow.document.body.scrollWidth;
    }
    document.getElementById(callback).height= (newheight) + “px”;
    document.getElementById(callback).width= (newwidth) + “px”; }
    </script>

    <p><button onclick=”history.go(-1);return true;”>Go Back</button>
    </p>

    </body>
    </html>

    Second alternative through mod_wrapper. I have seen in few documentation or forum that Joomla 3.x that original default.php doesn’t support Cross Domain iFrame.

    I have modified content of file ../modules/mod_wrapper/tmpl/default.php to below – result always cut, see attached screenshot:

    <?php
    /**
    * @package Joomla.Site
    * @subpackage mod_wrapper
    *
    * @copyright Copyright (C) 2005 – 2014 Open Source Matters, Inc. All rights reserved.
    * @license GNU General Public License version 2 or later; see LICENSE.txt
    */

    defined(‘_JEXEC’) or die;
    ?>
    <script type=”text/javascript”>
    function pageHeight(elem) {
    return elem.offsetParent ? (elem.offsetTop + pageHeight(elem.offsetParent)) : elem.offsetTop;
    }
    var buffer = -120; //scroll bar buffer
    function iFrameHeight() {
    var height = document.documentElement.clientHeight;
    height -= pageHeight(document.getElementById(‘blockrandom’))+ buffer ;
    height = (height < 0) ? 0 : height;
    document.getElementById(‘blockrandom’).style.height = height + ‘px’;
    }
    document.getElementById(‘blockrandom’).onload=iFrameHeight;
    window.onresize = iFrameHeight;
    </script>

    <iframe <?php echo $load; ?>
    id=”blockrandom”
    name=”<?php echo $target ?>”
    src=”<?php echo $url; ?>”
    width=”<?php echo $width ?>”
    height=”<?php echo $height ?>”
    scrolling=”<?php echo $scroll ?>”
    frameborder=”<?php echo $frameborder; ?>”
    class=”wrapper<?php echo $moduleclass_sfx ?>” >
    <?php echo JText::_(‘MOD_WRAPPER_NO_IFRAMES’); ?>
    </iframe>

    But still those two tries don’t resolve cut iFrame like attached screenshot.

    Could you share your though?

    Thanks and cheers.


    1. Bildschirmfoto-2014-11-04-um-10.12.44
    2. Bildschirmfoto-2014-11-04-um-10.11.39
    Ninja Lead Moderator
    #554214

    Where did you add this code on your site?


    <iframe <?php echo $load; ?>
    id="blockrandom"
    name="<?php echo $target ?>"
    src="<?php echo $url; ?>"
    width="<?php echo $width ?>"
    height="<?php echo $height ?>"
    scrolling="<?php echo $scroll ?>"
    frameborder="<?php echo $frameborder; ?>"
    class="wrapper<?php echo $moduleclass_sfx ?>" >
    <?php echo JText::_('MOD_WRAPPER_NO_IFRAMES'); ?>
    </iframe>

    Which area are you referring to on your site? Things at least look to be running smoothly from what I can see this iFrame on your site.

    I will help you to check this bug.

    ergcreative Friend
    #554379

    Hi Ninja Lead,

    I have changed file: /modules/mod_wrapper/tmpl/default.php

    from original
    Code:

    <script type="text/javascript">
    function iFrameHeight()
    {
    var h = 0;
    if (!document.all)
    {
    h = document.getElementById('blockrandom').contentDocument.height;
    document.getElementById('blockrandom').style.height = h + 60 + 'px';
    } else if (document.all)
    {
    h = document.frames('blockrandom').document.body.scrollHeight;
    document.all.blockrandom.style.height = h + 20 + 'px';
    }
    }
    </script>

    To
    Code:

    <script type="text/javascript">
    function pageHeight(elem) {
    return elem.offsetParent ? (elem.offsetTop + pageHeight(elem.offsetParent)) : elem.offsetTop;
    }
    var buffer = -120; //scroll bar buffer
    function iFrameHeight() {
    var height = document.documentElement.clientHeight;
    height -= pageHeight(document.getElementById('blockrandom'))+ buffer ;
    height = (height < 0) ? 0 : height;
    document.getElementById('blockrandom').style.height = height + 'px';
    }
    document.getElementById('blockrandom').onload=iFrameHeight;
    window.onresize = iFrameHeight;
    </script>

    The Result need to be checked after fill the iFrame content form and click button.
    i.e.
    Fly from: LAX
    Fly to: FRA
    Departure date: 29.11.2014 –> Departure time: any time
    Return date: 29.12.2014 –Return time: any time
    >> Click button

    It will return with limited frame’s height (I set in Wrapper scrollbar “No” – Auto Height “Yes”).

    I would like to have automatic iFrame Height-Resize.

    Thanks in advance.
    Cheers, Ega


    1. Bildschirmfoto-2014-11-06-um-09.25.05
    2. Bildschirmfoto-2014-11-06-um-09.29.41
    Ninja Lead Moderator
    #554405

    I just changed Height: 1000 the configuration in Wrapper Flights module and saw the div outside iFrame shows Height: 650px but div inside Iframe shows Height: over 5000px

    The javascript with iFrame didn’t work on this case. You have to fix the problem with Height outside iFrame.

    ergcreative Friend
    #554755

    Hi Ninja Lead,

    I just decided to create through Custom HTML in Article, not using Wrapper Module, and created java script at outside.
    Now its works. I know it’s a tricky part.

    Thank’s a lot.

    Cheers.

Viewing 5 posts - 1 through 5 (of 5 total)

This topic contains 5 replies, has 2 voices, and was last updated by  ergcreative 9 years, 11 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum