popup warning if you not posted

Currently reading:
popup warning if you not posted

Joined
Nov 5, 2004
Messages
19,051
Points
3,436
Location
Luke's Jedi Academy
So on several occasions recently (like just now, Grrrrrr) i have been writing a reply on a thread and go to delete something i've written due to spelling or something - but having inadvertently clicked outside the text box the backspace button becomes a back button for the browser and all of a sudden that big long detailed message that i have written disappears with no way of retrieving it.

This happens cause i use a laptop and sometime i catch the track pad as i'm typing (yes i could turn the track pad off i know, and usually do - but it defaults to on everytime I reboot etc)

Anyway, i was thinking would it not be possible to make a popup appear asking if you are sure you want to navigate away from the page without posting when you have started a reply? Like what happens on facebook if you type a comment but don't post and then click a link.
 
Little bit of JavaScript would do the trick?

Pseudo code
if messagebox.innertext != "" {
var answer = confirm("Do you want to abandon your post and navigate back?")
if (answer) {
//continue navigation
}
else {
//block back action
}
}
 
Back
Top