简体   繁体   中英

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.

除非您要定位较旧的浏览器,否则请尝试OnBeforeUnload。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM