Flying memes

A wiki engine in 40LOC with Service Workers

Service Workers are cool, a new technology that give you the power to write a proxy in Javascript that sits on your browser between the document and the server.

This means that you have now the ability to intercept all the http calls and decide what to do with each of them: let it proceed to the server or maybe respond with a cached version of the page or with some dynamically created content by the proxy itself.
The main purpose of all of this is, of course, dealing with no-connection situations but there are other interesting scenarios, one of them is shown here.

If you have some experience with wikis you know that you can create a new page by simply pointing the browser to a new URL within the same wiki domain. I’ve recreated the same behaviour using a ServiceWorker: it’s on github and there’s also a nice demo here:

ps: ServiceWorker is still under development and practically unsupported except for Chrome Canary, here’s a page that track its browser support:

Tags: ,