change location js code example Example 1: js change url Click to copywindow.location.href = "www.google.com"; Example 2: window replace url Click to copylocation.replace("url");