TiddlyWiki Tiny Improvement

time to read 2 min | 321 words

The single bad thing that I've found in TiddlyWiki is that it doesn't warns you about unsaved changes when you leave the page, with a potential to lose those changes.

Here is the fix* Change the:

  1. <body> tag to:
    <body onload="main()" onunload="askSaveChanges()">
  2. Add the following function to the <script type="text/javascript">
    function askSaveChanges()
    {
      
    var save = confirm("Save wiki's changes?");
      
    if(save)
            saveChanges();
    }

Now it will ask you at any unloading if you want to save. Pretty good solution in my book for this problem.

* This will ask for any unloading, whatever there are changes or not, so it's not ideal.