开发者

Exit browser confirmation in javascript - HOW TO ?

I have a flex application. In the wrapper jsp of the flex application, an html page开发者_StackOverflow中文版, 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 !


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜