window.location.replace error handling code example Example: window replace url location.replace("url");