When I close the browser window,I want to confirm the does the user really wants to close the browser window by calling the window.confirm() method. And when cancel button is pressed I want that the browser window does not close. I am calling window.confirm method when the onunload method is called. But this happens after the browser window gets closed so how do I handle this . Suggest some way.
unfortunately, if the user closes the browser with something other than that button (like clicking the little 'x' in the application window) you're out of luck. The onunload event will fire, but I don't think there's anything you can do can prevent the browser from closing . . .