开发者

How to detect a close of a browser using JavaScript or jQuery [duplicate]

开发者 https://www.devze.com 2023-04-05 03:16 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: Handle Browser close in JavaScript?
This question already has answers here: Closed 11 years ago.

Possible Duplicate:

Handle Browser close in JavaScript?

How to detect a close of a browser using JavaScript or jQuery, I got the window.onbeforeUnload and $(window开发者_开发知识库).unload() of JavaScript and jQuery respectively, but that even gets called on leaving of page,and etc... but I need only and only the close event, nothing else and only that.


Sorry, but this is impossible.


$(window).unload( 
function () { alert("You Are closing window"); }
);

is that what you mean

0

精彩评论

暂无评论...
验证码 换一张
取 消