Show message if user has entered content on page and not saved
<p>How can I show a message like a popup modal if a user has entered some content and then not saved it and try to leave the page?</p>

<p>Something like:</p>

<p><img src="http://i.stack.imgur.com/ZFQF9.png" alt="enter image description here"></p>

<p>This appears if you try to go to another page within Facebook BUT if you type in the URL then you get a native alert box like:</p>

<p><img src="http://i.stack.imgur.com/P5dRO.png" alt="enter image description here"></p>

<p>1.) What is the difference? Is the alert something that is built into browsers?</p>

<p>2.) How can I use jQuery to create my own custom modal boxes when similar events happen?</p>

<p>Thanks</p>
