title: How is Facebook handling their onbeforeunload confirmation dialog?
body: <p>When browsing Facebook in the latest Chrome on OSX, I noticed that beginning to type in a comment box and clicking another link or pressing the back button triggers a confirmation window asking if I'd like to leave:</p>
  
  <p><img src="https://i.stack.imgur.com/jmtZU.png" alt="Facebook Confirmation Dialog"></p>
  
  <p>Being an old school developer, I had believed that the only possibility was to attach an <code>onbeforeunload</code> event to the page to handle the back button click. I know you can do a global binding on the anchors to simulate <code>onbeforeunload</code>, but I was surprised they managed to have a custom styled confirmation and not the stock, ugly looking confirmation dialog.</p>
  
  <p><strong>How did they do it? Is this some kind of HTML5 window history or pushState event trigger?</strong></p>