Solution 1 :

The (method), will open in a new window. You can use window.location (object) along with .href = "urladdress" to redirect your browser to a new url address without opening a new tab.

See the following article on MDN: Window.location for more info.

Problem :

After clicking okay on my window.prompt a new tab opens using the code below. I want the user to go to the home page without opening a new tab.

if (window.confirm("Do you really want to leave?")) {"./Tutorial2", "Thanks for Visiting!");