change deprecated document.location.href to window.location.href