user3744056
user3744056

Reputation: 77

Javascript: onUnload event not working

I can't get the bit of JavaScript code. Was watching a tutorial on JavaScript so I tested it my self. I went to read up a bit and some sources said it did not work in Chrome so I tested with Firefox. However, it still did not work on Firefox. What went wrong?

    <body onUnload="alert('Good Bye!');"></body>

UPDATE: By the way, the person in the tutorial used

    <body onUnload="alert('Good bye');"></body>

and it worked for him. He was using a older version of Chrome.

Upvotes: 1

Views: 2265

Answers (1)

N-ate
N-ate

Reputation: 6926

Try OnBeforeUnload, unless you're targeting older browsers.

Upvotes: 1

Related Questions