assign() method of the
Location object can be used to navigate to a new web page.
Here is an example:
assign() except that it simulates an HTTP redirect and doesn't create an entry in the browser's history. It means that the user won't be able to use the back button to navigate back to the original document:
Finally, the last way to redirect the user to another web page is by using the
location.href property. It resembles the user's click event and produces the same effect as using the
location.href = `https://attacomsian.com`;
Location object properties and methods.