Added chrome compatibility and fixed compatibility issues with node.js

Hey Paul,

The library looks pretty good. If interested, feel free to accept the pull request. It adds compatibility for chrome and also fixed minor issues preventing it from working on node.js.

Tested on node 0.8.20 and chrome 27.