Confirmed. window.location.href.replace('http', 'ws') works.