Hi,
I have a sidebar application, which is used for web annotation.
I added the following code for handling the sidebar onload and onunload. When I press the close button, the onUnload event is called. Actually I need a confirm box, containing the text "Do you want to close the side bar?". Even when I press the cancel, the side bar is closed. How can I set "Ok" and "Cancel" options to the window.onUnload event? Is this only applicable for websites? Or Does Sidebar have special event handling for close?

Code:

onLoad: function(e) {
alert('load');
},
onUnload: function(e) {
if(confirm("Do you want to close the sidebar?"))
{
alert('closing');return true;
}
else
{
alert('continue');return false;
}

}
}

window.addEventListener("load", function(e) { skratch.onLoad(e); }, false);
window.addEventListener("unload", function(e) { skratch.onUnload(e); }, false);