简体   繁体   中英

How to detect if they left the Webpage?

我需要知道用户是最小化网页还是浏览器中的另一个选项卡,这可能吗?

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'); });

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