onClientInfo is not working as expected. Bug?

asked 2019-11-14 08:13:29 +0800

iliyar gravatar image iliyar

I'm using onClientInfo to get the browser size of user, then automatically adjust the window size accordingly. But it seem to only execute once. When the window is opened for second time, its back to default height/width value. Any ideas?

Here is a sample code:


delete flag offensive retag edit

1 Answer

Sort by » oldest newest most voted

answered 2019-11-14 09:47:03 +0800

cor3000 gravatar image cor3000
5673 2 7
ZK Team

onClientInfo is triggered initially and when the screen resizes. So I am surprised it calls even at first when you click the button. Maybe that's a bug. So when resizing your method is called every time, which is expected. (you can read the details here: https://www.zkoss.org/wiki/ZKDeveloper'sReference/UIPatterns/BrowserInformationandControl)

Anyway in order to automatically resize the window you don't need this event at all. I'd just use CSS:

<window ... style="width: 50vw; height: 50vh;">

In this case the window will size to 50% of the viewwidth/viewheight automatically. Here your updated zkfiddle:


link publish delete flag offensive 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




Asked: 2019-11-14 08:13:29 +0800

Seen: 13 times

Last updated: Nov 14 '19

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