Skip to content
Advertisement

onunload does in Chrome

I am opening a new window as below to

var nResult = window.showModalDialog("getSelection.asp?Type=" + inputType, "", "dialogHeight:220px; dialogWidth:400px; resizable=no; help:no; status:no");  

Now on getSelection.asp I have following syntax for body

<BODY onload="RetrieveDialogArguments();document.thisForm.ok.focus();" onunload="ReturnDialogArguments()" >

when I put alert then found that onload event works and call to RetrieveDialogArguments() but onunload event does not work and function ReturnDialogArguments() does not call. That’s why in nResult I did not get any value. This call works fine Internet Explorer but not in Google Chrome. Please tell me what is the issue with Google Chrome for this.

Advertisement

Answer

onunload is simply not supported in Chrome or Opera. There’s nothing you can do about that.

Use onbeforeunload instead, as in:

window.onbeforeunload = function () { // stuff here }
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement