From Documentation

Jump to: navigation, search



Instead of using iframe, there is a new way to use ZK in a non-ZK web container. For example, we could use NodeJs, Python, etc. as the web application, and embed another ZK application in the web pages.

  • Available for ZK:
  • ee.png
[ since 9.0.0 ]


Settings in the ZK application

We use library property to enable the embedded feature. For example: (In zk.xml)


Settings in the other application

When using Embedded ZK, we need to handle all of the requests, whose target URL point to ZK application.

To deal with this problem, we should handle the requests whose target is ZK application.

We could use Nginx or some apache solutions to redirect those requests to the ZK URL.

For example, we could add the following settings in Nginx : (ZK application - zktest)

location / {
	root   html;
	index  index.html;

location /zkembedded-app/ {


After doing all the settings in the ZK application and the non-ZK application, now we could embed ZK pages in our web application.

<!DOCTYPE html>
		<meta charset="UTF-8">
		<div id="embeddedZK" style="height:80%">  
<script id="embeddedScript"
			zEmbedded.load('embeddedZK', 'http://localhost/zk90test/demo.zul');

In line 11, we use <script> to load ZK embedded JS.

In line 14, we call zEmbedded to load the demo.zul, and the "embeddedZK" means that the embedded ZK page would be rendered in the corresponding DOM Element (DOM id).

To see more information, please download the Demo project.

API in embedded.js

We provide two API methods for embed ZK.

zEmbedded.load(domId, ZKSrc)

The "domId" means after loading resource from "ZKSrc", the content of "domId" (HTML DOM Element) would be replaced with the ZK content.

zEmbedded.destory(domId, skipError)

We can remove the specific ZK desktop in the HTML DOM Element. If "skipError" is true, the function would skip error messages when an error occurs.

Control ZK Components when using embedded ZK

After loading the ZK contents, we could use the ZK Client binding to control the ZK components in the view. To see more information, please refer to ZK MVVM Book - Client Binding.

Version History

Last Update : 2019/12/9

Version Date Content

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.