Foren

Liferay IFrame portlet auto-resize issue

Rhina Karr, geändert vor 12 Jahren.

Liferay IFrame portlet auto-resize issue

Junior Member Beiträge: 86 Beitrittsdatum: 02.11.10 Neueste Beiträge
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???
thumbnail
Hitoshi Ozawa, geändert vor 12 Jahren.

RE: Liferay IFrame portlet auto-resize issue

Liferay Legend Beiträge: 7942 Beitrittsdatum: 24.03.10 Neueste Beiträge
It's suppose to have been fixed. Please create a new issue in the jira.
http://issues.liferay.com/browse/LPS-15818
Rhina Karr, geändert vor 12 Jahren.

RE: Liferay IFrame portlet auto-resize issue

Junior Member Beiträge: 86 Beitrittsdatum: 02.11.10 Neueste Beiträge
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,
thumbnail
Hitoshi Ozawa, geändert vor 12 Jahren.

RE: Liferay IFrame portlet auto-resize issue

Liferay Legend Beiträge: 7942 Beitrittsdatum: 24.03.10 Neueste Beiträge
As I've written before, please create a new issue in Liferay jira to get it corrected because it's probably a bug.
thumbnail
Victor Zorin, geändert vor 10 Jahren.

RE: Liferay IFrame portlet auto-resize issue

Liferay Legend Beiträge: 1228 Beitrittsdatum: 14.04.08 Neueste Beiträge
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, geändert vor 10 Jahren.

RE: Liferay IFrame portlet auto-resize issue

New Member Beiträge: 8 Beitrittsdatum: 11.09.13 Neueste Beiträge
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");
});
});
Sravan kumar, geändert vor 9 Jahren.

RE: Liferay IFrame portlet auto-resize issue

New Member Beiträge: 4 Beitrittsdatum: 14.01.14 Neueste Beiträge
Hello CS,
How the issue is resolved, I did the below steps
1. Deployed IFrame hook(patch) to remove height style from IFrame.
2. Configured Height Normal to 900 and Height Maximized to 2000(maximum scroll). If we remove values for these 2 fields it leads to JS minifier issue. Also to verify the changes.
3. Added java script to page JS .

But still issue persists. Is any thing wrong above? Can you please shed a light

Thanks
Sravam
thumbnail
Rob Zondag, geändert vor 9 Jahren.

RE: Liferay IFrame portlet auto-resize issue

New Member Beiträge: 8 Beitrittsdatum: 07.08.12 Neueste Beiträge
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, geändert vor 9 Jahren.

RE: Liferay IFrame portlet auto-resize issue

New Member Beiträge: 4 Beitrittsdatum: 14.01.14 Neueste Beiträge
Hi Rob,

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

Thanks
Sravan
Sravan kumar, geändert vor 9 Jahren.

RE: Liferay IFrame portlet auto-resize issue

New Member Beiträge: 4 Beitrittsdatum: 14.01.14 Neueste Beiträge
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");
});
});
thumbnail
RICARDO GARCIA HERNANZ, geändert vor 9 Jahren.

RE: Liferay IFrame portlet auto-resize issue

New Member Beiträge: 4 Beitrittsdatum: 01.10.14 Neueste Beiträge
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, geändert vor 8 Jahren.

RE: Liferay IFrame portlet auto-resize issue

Junior Member Beiträge: 77 Beitrittsdatum: 03.09.13 Neueste Beiträge
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