0

I have a flex application. In the wrapper jsp of the flex application, an html page, i have to capture the browser close event with an alert "DO you wish to close?", if the user clicks "yes", i have to call a flex function to handle the event. Can any one help !

cucucool
  • 3,777
  • 8
  • 48
  • 63

2 Answers2

2

On your body tag, add onunload event:

<body onunload="doStuffHere();">
...
</body>

and in your JS function (doStuffHere) call Flex to handle the event. If, eventually, doStuffHere returns false, it cancels the close event.

You can also use onbeforedownload. See this Q&A for more details. You can use both of them, see why.

Community
  • 1
  • 1
Ofer Zelig
  • 17,068
  • 9
  • 59
  • 93
0

In javascript you have the onBeforeUnload event, hook on to that. You only cannot alter its appearance.

Gideon
  • 18,251
  • 5
  • 45
  • 64