Window id – sample application

I have created a sample application to demonstrate what we could do if we have a window id and what we suffer if we haven’t. The latter is our current situation.
The window id is simulated using Javascript to add a window id as hidden field to all forms and as parameter to all links on the screen.

This is part of the window id concept, I try to promote.

Download the sample application from http://www.laliluna.de/download/browser-feature-sample.zip

You will need Firefox 3, Internetexplorer 8 or Safari 4 to use this sample. It makes use of sessionStorage introduced with HTML 5.

Just for the intererested people:

I typed ramaze create sample in a terminal to create the raw application and just added my code.

Exploring the pitfalls

Modern browsers share cookies – including a session cookie – across all open browser windows and tabulators. This is in most cases what you want. If not you have to login again from every browser window you open on the same website.
The disadvantage is that a web developer can not store data into the session, because multiple browser windows would overwrite each others session values.
You can explore this problem following the failing link in the sample application. Just start to edit two turtles in two browser windows and finish the edit process. You end up with only one turtle being changed.
The following has happened:

Exploring the happy sample using the windows id

Navigate to the working example in two different browser tabs. You will see that you can independently edit a turtle.

Installing the prerequisites

Linux

Ruby and the rubygems package manager

sudo yum install install ruby rubygems

or to get a full environment

sudo yum install install ruby ruby-devel ruby-irb ruby-libs ruby-rdoc ruby-ri rubygems

Hint: On Debian/Ubuntu you will use aptitude to install ruby.

Mac Leopard
Ruby is already there. You should update the rubygems package manager. Input in a terminal

sudo gem update --system

Windows

Visit http://www.ruby-lang.org/ download and setup.

Visit http://rubygems.org/ download and install the ruby package manager.

Install ramaze

Inside of a terminal execute the ruby gems package manager to install ramaze and its depencies. I used the version 2009-05.
Sample for Mac and Linux

sudo gem install ramaze

Start the application

cd pathToSample
ruby start.rb

Open your browser and navigate to http://localhost:7000/