Fix window.location.origin, that is only available in webkit