use window.location.replace instead of window.open