Add polyfill for location.origin

Fixes #233