留言板

Liferay page without header and menu

Micael Ericsson,修改在10 年前。

Liferay page without header and menu

Regular Member 帖子: 169 加入日期: 12-12-11 最近的帖子
I am developing a small site with some pages populated with my portlets.

One of the portlets/pages ( result presentation portlet) should be a part of another site. My page should be displayed within a certain part of a specific page in that site. I have a boundary to fit the report within. My sites settings, such as theme, header, menu, login etc should not be visible in this specific page. Adjusting theme for this single page to adopt the parent site css is not a problem.

But how do I display only my portlet area in the other site? None of my sites header, menu, login link etc should be visible.
thumbnail
Juan Gonzalez,修改在10 年前。

RE: Liferay page without header and menu

Liferay Legend 帖子: 3089 加入日期: 08-10-28 最近的帖子
Hi Micael,

maybe you want to embed your portlets or configure and use WSRP.
Micael Ericsson,修改在10 年前。

RE: Liferay page without header and menu

Regular Member 帖子: 169 加入日期: 12-12-11 最近的帖子
Juan Gonzalez:
Hi Micael,

maybe you want to embed your portlets or configure and use WSRP.


I don't think these suggestions will work.
The other system is a .net based system. I can't include any of my code nor a WSRP. The only thing I can do is include a URL to a page on my site. I hope this explains what I want to do.
thumbnail
Krzysztof Gołębiowski,修改在10 年前。

RE: Liferay page without header and menu

Liferay Master 帖子: 549 加入日期: 11-6-25 最近的帖子
Maybe you can use the widget mechanism. Go to your portlet, open configuration and go to Sharing -> Any website. There is a javascript that should be put on the other website (but I think you can try to use provided url in iframe on destination system). Personally I haven't used this solution in production (but I always wanted to try emoticon ), we have done once an "iframe integration" but that was simply a page with blank theme containing our portlet.

Regards,
KG
Micael Ericsson,修改在10 年前。

RE: Liferay page without header and menu

Regular Member 帖子: 169 加入日期: 12-12-11 最近的帖子
Krzysztof Gołębiowski:
Maybe you can use the widget mechanism. Go to your portlet, open configuration and go to Sharing -> Any website. There is a javascript that should be put on the other website (but I think you can try to use provided url in iframe on destination system). Personally I haven't used this solution in production (but I always wanted to try emoticon ), we have done once an "iframe integration" but that was simply a page with blank theme containing our portlet.

Regards,
KG


This sounds like the perfect solution for me.
I gave it a little try. From my site (which still is localhost only) I copied the script my portlets configuration presented for sharing:

<script src="http://localhost:8080/html/js/liferay/widget.js" type="text/javascript"></script>
<script type="text/javascript">
	Liferay.Widget({ url: 'http://localhost:8080/widget/web/guest/admin/-/AdHgAdmin_WAR_AdHgAdmin10SNAPSHOT'});
</script>


For a simple test I created a test.html file and copied this code inside standard html, body tag.







<h1>Test</h1>
<script src="http://localhost:8080/html/js/liferay/widget.js" type="text/javascript"></script>
<script type="text/javascript">
	Liferay.Widget({ url: 'http://localhost:8080/widget/web/guest/admin/-/AdHgAdmin_WAR_AdHgAdmin10SNAPSHOT'});
</script>

End



Then I opened this with my web browser. My hope was that the portlet should be loaded with this html page. Since it's all javascript client code.
"Test" and "End" was shown with a number of blank row in between, but no portlet data.

Perhaps it's not possible to test shareing in this way. Do I need to put this code on a server of some sort?
thumbnail
Krzysztof Gołębiowski,修改在10 年前。

RE: Liferay page without header and menu

Liferay Master 帖子: 549 加入日期: 11-6-25 最近的帖子
I tested this code and in fact it does not work emoticon (but I think it used to work in the past).

When I run this code, browser console displays the following error:
Refused to display 'http://host/widget/web/guest/home/-/56_INSTANCE_TtFG4Bd9fkkh' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.

I read that X-Frame-Options was introduced recently (2010/11) to prevent vulnerabilities that were caused by "iframing" content. Basically option SAMEORIGIN says that this content can be iframed only on a website with the same domain as origin (http://tools.ietf.org/html/rfc7034#section-2.1). I tested this and put this snippet under the same domain - IFrame with my portlet has been loaded without any problems.

I think this may be and old functionality in Liferay, possibly it was introduced before X-Frame-Options header and it has not been adapted yet (and at the same time, Tomcat/Liferay automatically appends this header to all requests preventing all iframe vulnerabilities). Anyway, I've seen this is managed by separate servlet com.liferay.portal.servlet.WidgetServlet so I think it should be easy to override with ext or servlet filter hook.

I tested this on Liferay 6.2, maybe older versions behave in different way.

Regards,
KG
thumbnail
Juan Gonzalez,修改在10 年前。

RE: Liferay page without header and menu

Liferay Legend 帖子: 3089 加入日期: 08-10-28 最近的帖子
Hi Krzysztof,

you're right. That is a security improvement made in 6.2 to use that browser security check. I guess this code should work for Firefox or IE, but not for Chrome.
thumbnail
Krzysztof Gołębiowski,修改在10 年前。

RE: Liferay page without header and menu

Liferay Master 帖子: 549 加入日期: 11-6-25 最近的帖子
Thanks Juan, I created new jira issue for this case: https://issues.liferay.com/browse/LPS-45611.
thumbnail
Juan Gonzalez,修改在10 年前。

RE: Liferay page without header and menu

Liferay Legend 帖子: 3089 加入日期: 08-10-28 最近的帖子
Great,

please can you check what browsers are affected with this problem?

Thanks
thumbnail
Juan Gonzalez,修改在10 年前。

RE: Liferay page without header and menu

Liferay Legend 帖子: 3089 加入日期: 08-10-28 最近的帖子
You can disable that check by changing this property in portal-ext.properties:

http.header.secure.x.frame.options=false
thumbnail
Tomáš Polešovský,修改在10 年前。

RE: Liferay page without header and menu

Liferay Master 帖子: 676 加入日期: 09-2-13 最近的帖子
Hi Krzysztof,

put in your portal-ext.properties:
http.header.secure.x.frame.options.1=/widget/web/guest/home/-/56_INSTANCE_TtFG4Bd9fkkh


Or to allow all widgets from the home page:
http.header.secure.x.frame.options.1=/widget/web/guest/home/-/


This should help.
thumbnail
Krzysztof Gołębiowski,修改在10 年前。

RE: Liferay page without header and menu

Liferay Master 帖子: 549 加入日期: 11-6-25 最近的帖子
Hi Tomáš,
Thank you very much, I've learned something new about 6.2. I think this is also the answer for Micael's question.

Regads,
KG
Micael Ericsson,修改在10 年前。

RE: Liferay page without header and menu

Regular Member 帖子: 169 加入日期: 12-12-11 最近的帖子
Thanks Thomas. This solved my problem and gave me a perfect solution.
thumbnail
Krzysztof Gołębiowski,修改在10 年前。

RE: Liferay page without header and menu

Liferay Master 帖子: 549 加入日期: 11-6-25 最近的帖子
Micael, one more thing. If you start using widgets, you could write few words about them in this thread (if there were any problems or you had some specific observations). As I wrote before, I always knew about that functionality but I never used it in production emoticon

Thanks in advance,
KG
Kalpana P,修改在10 年前。

RE: Liferay page without header and menu

New Member 帖子: 5 加入日期: 14-4-8 最近的帖子
Hi Tomáš,

Is it possible to disable X-Frame-Options to only one page where that can be embedded in any website? Thanks in advance........
thumbnail
Tomáš Polešovský,修改在10 年前。

RE: Liferay page without header and menu

Liferay Master 帖子: 676 加入日期: 09-2-13 最近的帖子
Kalpana P:
Hi Tomáš,

Is it possible to disable X-Frame-Options to only one page where that can be embedded in any website? Thanks in advance........


Hi,

the syntax is similar / the same. Having a page with URL "/iframe-able", put in your portal-ext.properties:
http.header.secure.x.frame.options.1=/iframe-able
Markus Wiche,修改在8 年前。

RE: Liferay page without header and menu

New Member 帖子: 11 加入日期: 15-8-17 最近的帖子
Hi Thomas,

did you try if this works in "Liferay Portal Community Edition 6.2 CE GA5".
For me this doesn'r work. I tried all the options written in this thread.

As i can see the Portal Properties have been loaded.

Thanks, Markus
thumbnail
Pina Springer,修改在8 年前。

RE: Liferay page without header and menu

New Member 帖子: 16 加入日期: 10-2-16 最近的帖子
Hi to all,

the option http.header.secure.x.frame.options.1 etc. have to be in the system-ext.properties and NOT in portal-ext.properties.
This worked for me.

Best wishes,
Pina
强 邓,修改在7 年前。

RE: Liferay page without header and menu

New Member 发布: 1 加入日期: 13-10-8 最近的帖子
thumbnail
Mohammad Azharuddin,修改在8 年前。

RE: Liferay page without header and menu

Expert 帖子: 492 加入日期: 12-9-17 最近的帖子
HI Tomas

But when we open popup for configuration.. Again it is blocking ..

Look And Feel option is working.. But not the configuration
Rajaneesh Kethavarapu,修改在6 年前。

RE: Liferay page without header and menu

New Member 帖子: 12 加入日期: 13-2-20 最近的帖子
HI Thomas as you explained I tried by copying my script tags into a sample HTML file




<script src="http://localhost:8080/html/js/liferay/widget.js" type="text/javascript"></script>
<script type="text/javascript">
	Liferay.Widget({ url: 'http://localhost:8080/widget/web/guest/home/-/customerinformation_WAR_ReviewRatingportlet'});
</script>


<h1>This is a Heading</h1>



and in portlet-ext properties, I tried independently by keeping properties
http.header.secure.x.frame.options.1=/widget/web/guest/home
http.header.secure.x.frame.options.1=/widget/web/guest/home/-/
http.header.secure.x.frame.options=false

But nothing worked for me I am still getting below error

Refused to display 'http://localhost:8080/widget/web/guest/home/-/customerinformation_WAR_ReviewRatingportlet' in a frame because it set 'X-Frame-Options' to 'sameorigin'.
widget.js:13 GET http://localhost:8080/widget/web/guest/home/-/customerinformation_WAR_ReviewRatingportlet net::ERR_BLOCKED_BY_RESPONSE



Please give your suggestion