I can't trigger the unload event in Chrome

前端 未结 4 916
时光取名叫无心
时光取名叫无心 2020-12-17 18:58

This code runs fine on Firefox, but I can\'t make the unload event work on Chrome anymore. Did Chrome stop supporting the unload event?

This is my c

4条回答
  •  悲哀的现实
    2020-12-17 19:19

    You don't trigger anything - you just execute the expression which you want to add as a handler:

    window.onunload = function(event) {
        alert("Are you sure 2?");
    };
    

提交回复
热议问题