开发者

How to detect if they left the Webpage?

开发者 https://www.devze.com 2023-02-03 18:45 出处:网络
I need to be able to know if the user minimized t开发者_StackOverflow中文版he webpage or went to another Tab in their browser, Is that possible?Afraid not, the closest you can get is blur/focus on the

I need to be able to know if the user minimized t开发者_StackOverflow中文版he webpage or went to another Tab in their browser, Is that possible?


Afraid not, the closest you can get is blur/focus on the window object like this:

$(window).blur(function() { console.log('left'); });
$(window).focus(function() { console.log('came back'); });
0

精彩评论

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