title: Can you use JavaScript to detect whether a user has closed a browser tab? closed a browser? or has left a browser?
body: <p>To put you in the picture :</p>
  
  <ul>
  <li>A user is on a mobile device and is looking at a browser (i.e. Safari on an iPhone)</li>
  <li>They can see a password field to create a password in a modal box</li>
  <li>If the user were to close the modal box and come out of the browser I would like to send them an email to prompt them to create a password.</li>
  </ul>
  
  <p>My initial thought is there must be some sort of java-script event to be able to do this ?</p>
  
  <p>So can you detect the following user actions with JavaScript where a users has :
  - Closed a Tab
  - Closed their Browser
  - Left their browser </p>