Ticket #191 (closed Improvement)

Opened 3 years ago

Last modified 3 years ago

Warn users if they are leaving an editing session without clicking "save"

Reported by: idzelis@… Owned by:
Priority: Minor Milestone:
Component: Version: 1.4
Keywords: Cc:

Description

[jira2trac import : issue created on October 17, 2005 3:12:52 PM CEST http://issues.cocoondev.org/browse/DSY-191 ]

Lots of times users can be editing a document, and then someone IM's them a link or they click on another link somewhere. This will most of the time replace the active web browsing session with the link. The user may have been in the middle of editing it, so they may lose all their changes.

I think something like this: http://www.4guysfromrolla.com/webtech/100604-1.shtml should be implemented. It is very very easy to add. The gist of it is this (taken from article):

<script language="JavaScript?">
  var needToConfirm = true;

window.onbeforeunload = confirmExit;
  function confirmExit()
  {
    if (needToConfirm)
      return message to display in dialog box;
  }
</script>

...

<input type="Submit" value="Save" onclick="needToConfirm = false;" />

You can see it in action here:
http://www.4guysfromrolla.com/demos/OnBeforeUnloadDemo3.htm

Change History

comment:1 Changed 3 years ago by paul

  • Status changed from new to closed

[jira2trac import : comment created by bruno on October 17, 2005 3:58:14 PM CEST]

Thanks for the pointers & the example.

Back when the editor was first implemented, we looked at this but it was not yet available. Now that it is, we better start using it :-)

comment:2 Changed 3 years ago by paul

[jira2trac import : comment created by bruno on October 21, 2005 5:43:46 AM CEST]

I had a quick look to see if this is easy to add, but it will be a bit more work then I first thought.

The onbeforeunload script is triggered whenever the user leaves the page, not only when the window/tab gets closed. Thus e.g. following a link, pressing an action button, etc. also triggers the script.

comment:3 Changed 3 years ago by paul

[jira2trac import : comment created by bruno on November 16, 2005 1:10:10 PM CET]

Don't know what I was thinking when writing the previous comment, but this actually not hard to implement. Done now.

Note: See TracTickets for help on using tickets.