Added onbeforeunload handler/prompt (refs #4074)

A onbeforeunload handler is set to prevent accidental closure of window or tab.
Merge pull request #102 from eguaj/1.4-A4074

Added onbeforeunload handler/prompt (closes #4074)