Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
<iframe> causes Admin menu and portlet configuration menu not working
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.
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.
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.
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.
This actually isn't a Liferay problem. Iframes are not selfclosing. So you absolutely must have a closing tag.
Powered by Liferay™