更新时间:2023-12-01 21:28:28
通过一些技巧,您至少可以确定用户是否留下.
如果用户离开了页面,那么您无能为力:
With a few hacks you can at least determine if the user stayed.
If the user left the page, there's not much you can do about that :
var timeout;
$(window).on('beforeunload', function (){
timeout = setTimeout(function() {
// user stayed, do stuff here
}, 1000);
return "You save some unsaved data, Do you want to leave?";
});