Click to See Complete Forum and Search --> : javascript/chrome onunload issue


bluesource
August 20th, 2009, 03:33 PM
var win = window.open(page,'window','width=270, height=155, left=300, top=200');

alert('1');
win.onunload = function()
{
alert('2');
}

Consider the above code:


In firefox, I see the new window popup, get a '1' alert, then close the popup window, then see the '2' alert.

In chrome, I see the new window popup, get a '1' alert, then additionally get the '2' alert immediately following the '1'.
When I close the chrome window I get no alerts.

What is the reason for this and how can I resolve this issue?

PeejAvery
August 20th, 2009, 05:00 PM
Remember that they have two separate JavaScript engines. In my version of Firefox, the second alert does not fire. What version of Firefox are you running?