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
RE: Theme CSS not showing up in portlet embedded in external website
Hello,
I tried to embed a portlet in an external website (via <iframe frameborder="0" height="100%" src="http://localhost:8080/widget/web/abc/def/-/hij_WAR_klm_INSTANCE_abc123" width="100%"></iframe>). The problem is, that the CSS from the theme is not showing up, only the clay.css is loaded (which is the default I assume), so the portlet doesn't look the way it should.
Inside the Liferay portal site / page the theme is loaded without problems. How can I enable the loading of the whole theme for external websites as well so the portlet is styled correctly?
Thanks in advance!
I tried to embed a portlet in an external website (via <iframe frameborder="0" height="100%" src="http://localhost:8080/widget/web/abc/def/-/hij_WAR_klm_INSTANCE_abc123" width="100%"></iframe>). The problem is, that the CSS from the theme is not showing up, only the clay.css is loaded (which is the default I assume), so the portlet doesn't look the way it should.
Inside the Liferay portal site / page the theme is loaded without problems. How can I enable the loading of the whole theme for external websites as well so the portlet is styled correctly?
Thanks in advance!
A theme can be a big thing... Probably not a good idea to load it on the destination website. Maybe you could include the minimal necessary CSS with your portlet...?
HTH
Fernando
HTH
Fernando
Maria Maier:
...
Inside the Liferay portal site / page the theme is loaded without problems. How can I enable the loading of the whole theme for external websites as well so the portlet is styled correctly?
Hard to say as we don't see the actual output. You may want to look into CORS headers, or into http/https mixed content policies
If you call the url directly from the browser (I mean: http://localhost:8080/widget/web/abc/def/-/hij_WAR_klm_INSTANCE_abc123 ), does it work? If it does, you probably run into some kind of security or setting issue.
Does the browser developer console tell you anything (e.g. access forbidden due to access policy or something like that?)
Are you indeed using the localhost url for an Iframe? I would avoid that in general, you might run into weird security issues. localhost is special.
I also just tried it with DXP 7.2 (some older patch level) and it doesn't allow me to use an IFrame due to the X-Frame-Options: sameorigin policy. I guess, you have changed that (I am sure, there is a setting somewhere for that). Maybe the correct header is not applied to all files? (Just guessing here)
Does the browser developer console tell you anything (e.g. access forbidden due to access policy or something like that?)
Are you indeed using the localhost url for an Iframe? I would avoid that in general, you might run into weird security issues. localhost is special.
I also just tried it with DXP 7.2 (some older patch level) and it doesn't allow me to use an IFrame due to the X-Frame-Options: sameorigin policy. I guess, you have changed that (I am sure, there is a setting somewhere for that). Maybe the correct header is not applied to all files? (Just guessing here)
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™