Confirmation message at page unloading

Hi
I m using below code to show the confirmation message at the time of unloading of page, but its not working. please help me.

isc.Page.setEvent("unload", function () {
    	unloadPage();
	});


function unloadPage() {
			if(LocationList.hasChanges())
			{			isc.confirm("You have unsaved data in the page. Do you want to save before leaving?", null,
                        {targetGrid:LocationList,
                        buttons:[isc.Dialog.YES, isc.Dialog.NO, isc.Dialog.CANCEL  ],
	          yesClick : function () {
                            this.hide();
                            saveLocationList();						  closePage('LocationForm', '<s:property value='closeAuthUrl'/>');  }
                     	
                           noClick : function () {
                            this.hide();
                            this.targetGrid.cancelEditing();
                           closePage('LocationForm', '<s:property value='closeAuthUrl'/>');   },

                        cancelClick : function () {
                           this.hide();
                        }

                    }
            	);
}

Browsers won’t let you block unload (from a security perspective). The most you can do is implement the native event “onbeforeunload”, which will let you prompt the user with a text message inside a native dialog that makes it clear that the message is coming from the current web page. Search via google for many examples.