Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Deepjyoti Nath
Liferay IFrame portlet auto-resize issue
April 14, 2012 10:54 PM
Answer

Deepjyoti Nath

Rank: Junior Member

Posts: 81

Join Date: November 1, 2010

Recent Posts

Hi Guys,

I am using Liferay 6.1. I have a requirement to embed a Liferay Iframe portlet in a page. The iframe portlet contains an application running on a different server on different machine.Now I am able to integrate the application, but the iframe doesn't resize based on the application's data, instead it added a scroll bar. I don't want a scroll bar in the iframe. If the data inside the iframe is large, the iframe should automatically resize in the page.
I found that if the application in the iframe is hosted on thesame server(where Liferay is running), then auto resize works. But if the application is on different server, how can we make the iframe resize automatically, instead of scrollbar.
Any solution???
Hitoshi Ozawa
RE: Liferay IFrame portlet auto-resize issue
April 14, 2012 11:08 PM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7949

Join Date: March 23, 2010

Recent Posts

It's suppose to have been fixed. Please create a new issue in the jira.
http://issues.liferay.com/browse/LPS-15818
Deepjyoti Nath
RE: Liferay IFrame portlet auto-resize issue
April 15, 2012 5:37 PM
Answer

Deepjyoti Nath

Rank: Junior Member

Posts: 81

Join Date: November 1, 2010

Recent Posts

Hi Hitoshi,
Thanks for your reply.
I am testing it in IE8 browser. As per the LPS issue, it was working in Firefox, but not Chrome. But in my case, its not working in IE, if my external application, configured with Iframe is hosted in a different server. I'mworking with Liferay 6.1. Any solution from you is appreciated.

Thanks,
Hitoshi Ozawa
RE: Liferay IFrame portlet auto-resize issue
April 15, 2012 5:58 PM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7949

Join Date: March 23, 2010

Recent Posts

As I've written before, please create a new issue in Liferay jira to get it corrected because it's probably a bug.
Victor Zorin
RE: Liferay IFrame portlet auto-resize issue
June 17, 2013 7:49 PM
Answer

Victor Zorin

Rank: Liferay Legend

Posts: 1178

Join Date: April 14, 2008

Recent Posts

We have hit similar issues related to the managing of height of iFrame portlet following to changes in content height.

IFrame portlet does not do it properly even for applications running on the same server, this includes Liferay Enterprise 6.1.20 environments.

A jsp hook was made to address this, at the moment it can be downloaded from this link:
http://www.myoffice24x7.com/documents/10162/37311/iframe-portlet-hook

We suspect that the issue comes from iframe attribute height being auto-populated from some default data (e.g. height='600'), who knows where it came from...
If content actual height goes over 600px, we can see that the style is being updated properly by auto-resize javascript, but in some browsers 'height' attribute takes precendence over style values.

This patch removes height attribute from the iframe tag.
c s
RE: Liferay IFrame portlet auto-resize issue
April 7, 2014 1:39 PM
Answer

c s

Rank: New Member

Posts: 8

Join Date: September 11, 2013

Recent Posts

I was having weird issues with the height of the iFrame as well and even the hook mentioned above, did not seem to work as expected. What worked for me is adding the following JavaScript to the page where the IFrame portlet is added. This works in IE, Chrome and Firefox.

$(window).load(function() {
$(window).resize();
});
$(document).ready(function() {
$(window).resize(function() {
fullHeight = $(window).height();
headerHeight = $("#banner").outerHeight();
footerHeight = $("#footer").outerHeight();

$("iframe").height((fullHeight-headerHeight-footerHeight-60)+"px");
});
});
Rob Zondag
RE: Liferay IFrame portlet auto-resize issue
May 8, 2014 4:55 AM
Answer

Rob Zondag

Rank: New Member

Posts: 5

Join Date: August 7, 2012

Recent Posts

Hi Victor,

We have the same issue here (the tickbox in the iFrame configuration "Resize Automatically" does not work).
Basically it will still use the values provided in the fields when un-ticked or the defaults (600px).
I have deployed the hook you made available on our test systems without success.

11:40:17,733 INFO [localhost-startStop-2][HotDeployImpl:178] Deploying iframe-portlet from queue
11:40:17,736 INFO [localhost-startStop-2][PluginPackageUtil:1033] Reading plugin package for iframe-portlet
11:40:17,830 INFO [localhost-startStop-2][HookHotDeployListener:550] Registering hook for iframe-portlet
11:40:17,835 INFO [localhost-startStop-2][HookHotDeployListener:690] Hook for iframe-portlet is available for use

I'll raise a LESA ticket for this as we're on 6.1.20 EE ... with support.

Cheers,

Rob
Sravan kumar
RE: Liferay IFrame portlet auto-resize issue
May 19, 2014 2:58 PM
Answer

Sravan kumar

Rank: New Member

Posts: 4

Join Date: January 14, 2014

Recent Posts

Hi Rob,

Did you receive any updates on this issue. We are also facing the same issue here.

Thanks
Sravan
Sravan kumar
RE: Liferay IFrame portlet auto-resize issue
May 23, 2014 1:20 AM
Answer

Sravan kumar

Rank: New Member

Posts: 4

Join Date: January 14, 2014

Recent Posts

Use the attached iframe hook to remove the dependency of height from portal configuration.

In Page configuration, use the JS code which is shared in this post to adjust the height

$(window).load(function() {
$(window).resize();
});
$(document).ready(function() {
$(window).resize(function() {
fullHeight = $(window).height();
headerHeight = $("#banner").outerHeight();
footerHeight = $("#footer").outerHeight();

$("iframe").height((fullHeight-headerHeight-footerHeight-60)+"px");
});
});
Attachments: iframe-portlet-hook.war (66.8k)
RICARDO GARCIA HERNANZ
RE: Liferay IFrame portlet auto-resize issue
February 2, 2015 1:24 AM
Answer

RICARDO GARCIA HERNANZ

Rank: New Member

Posts: 5

Join Date: October 1, 2014

Recent Posts

Hi,

I'm trying to use the hook you provided but I'm not sure where I have to include the javascript code. When you say Page configuration... Do you refer to the page refered in the iframe? If so, this page must be in the portal server or can be a page outside the server?

Thank you in advance.
Paul Allain
RE: Liferay IFrame portlet auto-resize issue
September 21, 2015 3:09 AM
Answer

Paul Allain

Rank: Junior Member

Posts: 25

Join Date: September 3, 2013

Recent Posts

RICARDO GARCIA HERNANZ:
Hi,

I'm trying to use the hook you provided but I'm not sure where I have to include the javascript code. When you say Page configuration... Do you refer to the page refered in the iframe? If so, this page must be in the portal server or can be a page outside the server?

Thank you in advance.


Hey Ricardo,

I'm trying to solve this problem by following all the explanations above without much success.

Have you managed to solve the iFrame height issue?

Thanks
Paul