0

Run zkoss site inside an iframe from another domain

asked 2021-02-20 01:40:06 +0800

agsiegel gravatar image agsiegel
6 1

updated 2021-02-20 01:45:53 +0800

I would like to embed a zkoss website inside an iframe on another domain. For example

on site1.com there is a page ...

<html>
<body>
<iframe src="https://www.site2.com/index.zul"></iframe>
</body>
</html>

The zk app keeps resetting. Not sure if this is a cross domain scripting or session id cookie problem. Accessing the zk app directly on site2 works fine.

The application on site2 is running under Jetty behind an nginx proxy.

Appreciate any suggestions.

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-02-22 10:46:40 +0800

cor3000 gravatar image cor3000
6280 2 7

updated 2021-03-01 09:50:30 +0800

ZK is unaware of running inside an iframe, so there's nothing to do/configure inside ZK.

The zk app keeps resetting.

This error description is not very precise. So I can't help this that. I assume you don't know where to look yet to obtain more details.

So my initial suggestion is to open the browser's developer tools (e.g. in Chrome [F12]) and check for console errors (e.g. about cross origin problems and/or cookie warnings/errors) -> those errors will often even contain links to documentation about how to address them.

To get even more details you should also look into the network tab of the developer tools. There you'll see whether requests succeed or fail, as well as which cookies are sent and received.

Looking into the browser's developer tools is generally the first thing to do and compare what you expect against what's actually happening. Then you'll have more information to post in a forum question and sometimes even the solution provided by the tools. (Other browsers have similar tools)

link publish delete flag offensive edit

Comments

The developer tools show that the browser can't retrieve zul.lang.wpd when in an iframe. When not in an iframe works fine.

agsiegel ( 2022-03-08 11:39:46 +0800 )edit

"the browser can't retrieve zul.lang.wpd": that's a starting good point. That'll prevent ZK from working propertly. Next I'd look into the network tab so see what URL is being requested and which error occurs.

cor3000 ( 2022-03-08 11:57:36 +0800 )edit

It's a 404 error. For zk.bind.wpd as well. Everything works fine when not accessing the site from an iframe. But put the src url in an iframe and start getting 404 errors from another domain. Other .wpd files are retrieved without issue. Appreciate your thoughts very much. Thank you.

agsiegel ( 2022-03-09 08:59:50 +0800 )edit

That's exactly the details that matter ... which URL is requested for zk.bind.wpd when running outside the iframe, and which URL is requested when running inside the iframe. if there's "another domain", then the network tab will indicate which JS code or script tag initiated the request.

cor3000 ( 2022-03-09 13:06:23 +0800 )edit

I finally came across this article which solved the issue - https://www.zkoss.org/wiki/ZK_Developer%27s_Reference/Integration/ZK_Embedded/Embedded_ZK_Application (https://www.zkoss.org/wiki/ZKDeveloper%27sReference/Integration/ZKEmbedded/EmbeddedZK_Application)

agsiegel ( 2022-07-29 00:42:06 +0800 )edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2021-02-20 01:40:06 +0800

Seen: 8 times

Last updated: Mar 01 '21

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More