Support browser environment too.

I used the same checking code as debug does (the try/catch) to avoid
inconsistencies.

also updated the readme.
Merge pull request #2 from AdrianRossouw/fix/browser-support

Support browser environment too.