Replace location.origin, as IE does not support it.