3 ms·
Now try doing it when you close a tab/page. IE11 is the last browser that can reliably send a request before the tab closes (by using synchrous). I swear tell
by Aeolun 5y ago
Now try doing it when you close a tab/page.
IE11 is the last browser that can reliably send a request before the tab closes (by using synchrous).
I swear telling the business guys that we had no way to run an action when someone closed the page had them nearly running back to IE. And for that specific functionality, I find it hard to disagree.
In our case, we lock entities when someone starts working on them, but now we have no way to unlock them if they fat-finger the close button, or press one too many backspaces.
- vesinisa 5y agoHow about if someone just forgets the document open on their browser? Or their network connection is down when they close the browser window? You eventually have to somehow deal with documents that are left locked, no matter what (google CAP theorem.) On a general level, locking is a subpar solution for distributed systems. You should try to build support for automatic resolution of (most) edit conflicts instead, and forego locking altogether. If that's not possible, try to make the locks smart, e.g. so they auto expire unless periodically renewed.
- Aeolun 5y agoThey do auto expire, but it’s not a great user experience to tell someone to ‘just wait an hour’.
- Rizz 5y agoYou can use web sockets for this sort of functionality, the socket is closed as soon as the browser is closed.
- Aeolun 5y agoYeah, I’d thought about that after reading a few comments here, but it feels a bit like using a shotgun to kill a fly.