Code: Select all
<script type="text/javascript">
window.onbeforeunload = function()
{
if(text_changed)
return "You didn't posted your message blah blah blah :mrgreen: ";
}
</script>
Code: Select all
<script type="text/javascript">
window.onbeforeunload = function()
{
if(text_changed)
return "You didn't posted your message blah blah blah :mrgreen: ";
}
</script>
not a full job without help of coderscallumacrae wrote:That's the browsers job. Some of them do.
+1Arty wrote:Please no. That's one of the most annoying functions on some forums that do use it.
If I changed my mind when posting and decided to close browser tab, I did that on purpose. I don't want script to second guess my decision.
Not with HTTPS, though.Senky wrote:-1 to RFC - nowadays, all modern browsers restore text even when you re-open window.
There are cases when you accidentally close a tab. Many times I've hit cmd + q instead of cmd + w. Restore previous session is one of my favorite features.Arty wrote:If I changed my mind when posting and decided to close browser tab, I did that on purpose. I don't want script to second guess my decision.