-
AuthorPosts
-
November 4, 2014 at 9:06 am #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.
-
Ninja Lead Moderator
Ninja Lead
- Join date:
- November 2014
- Posts:
- 16064
- Downloads:
- 310
- Uploads:
- 2864
- Thanks:
- 341
- Thanked:
- 3854 times in 3563 posts
November 5, 2014 at 4:32 am #554214Where 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.
November 6, 2014 at 8:34 am #554379Hi 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 buttonIt 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-
Ninja Lead Moderator
Ninja Lead
- Join date:
- November 2014
- Posts:
- 16064
- Downloads:
- 310
- Uploads:
- 2864
- Thanks:
- 341
- Thanked:
- 3854 times in 3563 posts
November 6, 2014 at 10:36 am #554405I 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.
November 10, 2014 at 1:07 pm #554755Hi 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.
-
AuthorPosts
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
Jump to forum
-