0

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.

Brian Tompsett - 汤莱恩
  • 5,438
  • 68
  • 55
  • 126
agarwal_achhnera
  • 2,516
  • 8
  • 53
  • 77

2 Answers2

3

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 }
Albert Xing
  • 5,230
  • 3
  • 20
  • 40
1

You can try using window.onbeforeunload for Chrome.

Or use jQuery bind function with onbeforeunload event.

Chirag Bhatia - chirag64
  • 4,224
  • 2
  • 24
  • 34