Open a new window automatically after a certain number of seconds

I would like a suggestion on how I can create a Source page that automatically opens another page in a new window (in this case a store) after 15 seconds.

In practice now the page contains some buttons that open other pages, for example if 15 seconds pass (it would be nice to also insert and display a countdown), the store should automatically open in another window.

I don’t think it’s difficult, but unfortunately I’m out of ideas…

Thank you

solved, in case anyone needs it:

<p>Accesso in <span id="seconds">15</span> secondi
</p>

javascript:

var seconds = 15; // seconds for HTML
var foo; // variable for clearInterval() function

function redirect() {
    window.location.href = 'https://half-moon-by-cesar-salumi-porchettificio.sumupstore.com';
}

function updateSecs() {
    document.getElementById("seconds").innerHTML = seconds;
    seconds--;
    if (seconds == -1) {
        clearInterval(foo);
        redirect();
    }
}

function countdownTimer() {
    foo = setInterval(function () {
        updateSecs()
    }, 1000);
}

countdownTimer();
1 Like