<iframe> causes Admin menu and portlet configuration menu not working

thumbnail
Abdollah Esmaeilpour, modified 4 Years ago. Junior Member Posts: 60 Join Date: 8/22/09 Recent Posts

I want to show a page of a site in an <iframe> inside a portlet. The URL of the page can have various parameters, so I need to dynamically build the URL and set it like <iframe scr="https://my-site.com/my-url?param=something"/>. The portlet displays the page successfully but Liferay's Admin menu and the portlet configuration menu not working. The portlet is a very simple struts portlet that based on a request parameter decides which parameter should be set as the iframe's URL's parameter. I tried different sites but no success.

thumbnail
Christoph Rabel, modified 4 Years ago. Liferay Legend Posts: 1555 Join Date: 9/24/09 Recent Posts

I don't think the iframe is doing it. I would try to remove everything from the portlet, just write "Hello World" or something to see that it is there. If the issue goes away, the cause was somewhere in the removed code. Then try to add stuff, till you hit the issue again.

If the issue doesn't go away, it has to be somewhere else in your project. In really mysterious cases I usually create a new project and start adding till it stops working.

 

 

thumbnail
Abdollah Esmaeilpour, modified 4 Years ago. Junior Member Posts: 60 Join Date: 8/22/09 Recent Posts

I had tried removing <iframe> from the portlet and it had resolved the issue. Even I deployed my portlet without <iframe> and in browser devtools added an <iframe> and the problem appeared again. Building a new project is a good idea. I will try building an MVC portlet instead of the Struts portlet (my current portlet is a Struts portlet) and check the result.

thumbnail
Abdollah Esmaeilpour, modified 4 Years ago. Junior Member Posts: 60 Join Date: 8/22/09 Recent Posts

I must have written

<iframe> ... </iframe>

but I had written

<iframe ... />

The problem is a Liferay issue with <iframe>: https://issues.liferay.com/browse/LPS-7100
The issue has been closed but I found this problem existing in Liferay 6.2.

 

 

thumbnail
Christoph Rabel, modified 4 Years ago. Liferay Legend Posts: 1555 Join Date: 9/24/09 Recent Posts

This actually isn't a Liferay problem. Iframes are not selfclosing. So you absolutely must have a closing tag.