Changing to an actual feature-detect.

Firefox throws an exception if you try to assign to location.origin, as it marks it read-only.