How to tell if you're disconnecting?

Options
I want the player object to drop his weapons before he disconnects. And I mean disconnects without an exit button, like he just closes the tab (my game's webgl) so how do I tell if you're disconnecting, like Unity's OnDisable method?