[英]Javascript: onUnload event not working
I can't get the bit of JavaScript code. 我听不懂JavaScript代码。 Was watching a tutorial on JavaScript so I tested it my self.
正在看有关JavaScript的教程,所以我自己进行了测试。 I went to read up a bit and some sources said it did not work in Chrome so I tested with Firefox.
我去阅读了一下,一些消息来源说它在Chrome中不起作用,所以我在Firefox上进行了测试。 However, it still did not work on Firefox.
但是,它仍然无法在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.
他使用的是旧版的Chrome。
除非您要定位较旧的浏览器,否则请尝试OnBeforeUnload。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.