Update: On February 12, 2012 I released an updated version of this app with new UI, support for Markdown syntax (incl. editor) and a few bug fixes. Please see the project page for more screenshots and downloads.
Ever since the days of Google Gears which enabled local storage and offline syncing for online applications such as Google Reader and Docs, I have always wished for a very simple and instantly accesible notepad application that I could host on my server and use also without an internet connection. A place where I could instantly write down an idea or paste a link or a quote from an article.
Google Docs and Evernote is great but they have way more features than I would normally use. WordPress is fine, but it takes several steps to get to the actual writing, and you must be connected to the internet to use it.
Now that we have HTML5 with support for
localStorage and offline apps in all of the modern browsers, it seems to be the perfect solution. All that is needed is a little PHP script that synchronizes the content of
localStorage with the server. Here is how it looks:
You have your files on the left and a very big plain text editor on the right.
How Does it Work
The app consists of the following:
- One HTML file with enabled offline access (cache manifest).
- One PHP file with HTTP authentication for syncing with the server.
The files are stored in browser’s
localStorage as key/value pairs with unique timestamp IDs as key and JSON formated content as value. An index of all files and their version timestamps is kept and used for synchronization during which all the content of
localStorage is sent to
sync.php in a POST request. The server reads its own index file and determines which new or edited entries need to be stored and which returned to the browser. All entries are stored on the server as JSON strings in simple text files.
Demo, Download and Installation
Please visit the project page of the HTML5 Notepad App. There is also a sample Chrome app.