No, you can't know that, the HTML page isn't the "owner" of the browser, you have only limited access to information, and this info isn't inside it.
You can know when the user leaves your page, but you can't know why, as it's none of your business...