1👍
✅
There is no 100% dependable way to tell when someone has left your page. The best you can do is use some AJAX polling and assume that the user has left once the polling stops or perhaps use web sockets (not universally available) to keep a connection open.
For example – I’m browsing your site with my tablet, and I lose my Internet connection. beforeunload
will not help you in that situation.
0👍
Basically you have a race condition which the browser normally wins.
Modern day browsers try to speed up the pages as fast as possible. People hate waiting for the next page to load so what they did was kill any request that is opened at unload/beforeunload. Older browsers would wait for a for loop, but they killed that.
- [Answer]-DoesNotExist at /admin
- [Answer]-MySQLdb import error on windows 7 + Django
- [Answer]-Django averages – average number of events per weekday
- [Answer]-Make django date not editable
- [Answer]-Save_m2m 'unicode' object has no attribute 'set'
Source:stackexchange.com