0

Clients.confirmClose() method in ZK Framework pops up window saying "Are you sure want to leave this page?" with two buttons- leave this page , stay on this page. I want to perform some operation when user clicks on buttons either "leave this page" or "stay on this page"? Can any body suggest me how can i achieve this?

Nandeshwar
  • 94
  • 1
  • 9

1 Answers1

0

This happens in mount.js; search for window.onbeforeunload.

The standard JavaScript event onbeforeunload shows the dialog when the registered function returns a string (docs).

If you want to override the behavior, you need to install your own handler and use the setTimeout() trick described in this question: Way to know if user clicked Cancel on a Javascript onbeforeunload Dialog?

Note that it's not possible to do something in the "leave page" case since the browser will have killed all the JavaScript that you have written at this time.

Community
  • 1
  • 1
Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820