Use windows.location instead of document.location to set the new url