Fixing use of window.location.origin for compatibility reasons.