Basically, you can't - there is no reliable method that works for all browsers, and even if there were, that wouldn't help if there was a power cut, for example, or the browser is closed with "End Task".
The best way to do this is to kill the DB when the Session expires: that way it's independent of what happens at the client. See
Session-State Events[
^] and look at the Session_OnEnd event.