0

I want to close browser after clicking a button using zk framework

asked 2011-03-18 07:21:46 +0800

shankard gravatar image shankard
120 2

hi all,
I want to take a close button in my login page and after clicking on this close button browser should be closed. How to achieve this please reply.

Thanks All

delete flag offensive retag edit

6 Replies

Sort by ยป oldest newest

answered 2011-03-21 02:44:59 +0800

leoyc gravatar image leoyc
163 3

I want to do it.

link publish delete flag offensive edit

answered 2011-03-21 05:40:15 +0800

shankard gravatar image shankard
120 2

Thank you for reply sir,

but this is not a solution we have to find the solution...and if any body knows...please post here.....


thanks all

link publish delete flag offensive edit

answered 2011-03-21 11:24:05 +0800

Steva77 gravatar image Steva77 flag of Italy
1014 3
http://www.research.softe...

What about listening to the onClick event of the button and then using Clients.confirmClose(String message) to ask for confirmation?

http://books.zkoss.org/wiki/ZK_Developer%27s_Reference/UI_Patterns/Browser_Information_and_Control

This is usually done to prevent closing, but could help the other way round.

Hope it helps,
Stefano

link publish delete flag offensive edit

answered 2011-03-21 23:07:03 +0800

shankard gravatar image shankard
120 2

Thank you Stefano !
I tried Clients.confirmClose(String) method with Mozila,Crome and intenate Explorer but it is not working the option is coming for preventing to close the browser but after clicking ok it is not closing browser it is just refreshing the web browser....any way thaks for your suggestions....if there is any other way to do this please reply.............I just called on method closeBrowser() in which i have the following code:-


<zul:button id="close" label="${c:l('common.button.close')}" mold="os" onClick="java:closeBrowser()">
<zul:zscript language="java">
void closeBrowser(){
Clients.confirmClose("Are you sure want to close the application?");
}
</zul:zscript>
</zul:button>


i tried with <zul:attribute> also...the code is as follows:-

<zul:button id="close" label="${c:l('common.button.close')}" mold="os">
<zul:attribute language="java" name="onClick">
Clients.confirmClose("Are you sure want to close the application?");
</zul:attribute>
</zul:attribute>

thanks all

link publish delete flag offensive edit

answered 2011-03-22 04:14:40 +0800

Steva77 gravatar image Steva77 flag of Italy
1014 3
http://www.research.softe...

I see... maybe the Clients.confirmClose is meant only to listen to the close event on the browser and let it go if the user confirms, but it does not work on its own...
No further suggestions unfortunately... BTW you can try some javascript but that means to fight against each single browser...

link publish delete flag offensive edit

answered 2011-03-29 23:21:26 +0800

henrichen gravatar image henrichen
3869 2
ZK Team

Closing browser window is an OS level operation. I don't think ZK can help on this specific requirement. I would suggest using ZK's modal window and you can close it easily.

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

RSS

Stats

Asked: 2011-03-18 07:21:46 +0800

Seen: 1,077 times

Last updated: Mar 29 '11

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