简体   繁体   English

检测已卸载的Facebook App画布

[英]Detect Facebook App Canvas Unloaded

I need to detect that a user unloads my Facebook app (navigates to somewhere else or logs out of Facebook). 我需要检测到用户正在卸载我的Facebook应用程序(导航到其他地方或注销了Facebook)。 How can this be done? 如何才能做到这一点? I have tried: 我努力了:

FB.Event.subscribe('auth.logout', function(response) {
    console.log('logged out');    
});

But this never fires :( 但这永远不会触发:(

why not try to listen to the window unload event rather than using the Facebook API: 为什么不尝试监听窗口卸载事件而不是使用Facebook API:

window.addEventListener('unload', function(event) {
   console.log('Bye bye!');
});

This should catch the situations you need 这应该可以满足您的需求

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM