Archive for February, 2010

* Require RubyGems

Posted on February 19th, 2010 by Dave Johnson. Filed under ruby.


I have never really written much ruby outside of a Rails app and so when I wanted to write a short script for a cron job.

I kept getting an error like:

‘require’: no such file to load — some_gem (LoadError)

In the end it was all because I had forgotten to first require rubygems!

It was a hard thing to find an answer to from The Google.

Tags: , , .



* HTML 5 and sessionStorage

Posted on February 19th, 2010 by Dave Johnson. Filed under JavaScript, quirks.


We came across a strange bug today that was being caused by our recent addition of sessionStorage to our application.

The Mozilla Developer Center says this about sessionStorage:

This is a global object (sessionStorage) that maintains a storage area that’s available for the duration of the page session. A page session lasts for as long as the browser is open and survives over page reloads and restores. Opening a page in a new tab or window will cause a new session to be initiated.

Emphasis mine.

What we found was that of the three different browsers that currently “support” sessionStorage, there are three different implementations. Go figure.

I looked at a few different ways of opening new windows or tabs and those included anchor tags with target values of “” and “_blank”, window.open() JavaScript calls with different targets, and context menu open in new window or tab.

Internet Explorer 8 is furthest from the spec, as one might expect. No matter how you opened a new window from the page, the sessionStorage is preserved in the new window.

Firefox is only slightly better in that it does not preserve the sessionStorage in new windows when the new window is created by choosing open in new window / tab from the context menu on an anchor.

Safari is more or less like Firefox except that it does not preserve the sessionStorage when the target on an anchor is “_blank”.

In short, if you are expecting that sessionStorage is tied to a single browser window then think again.

Tags: , .