What is the best practice for opening multiple pages in a frame based on a countdown in PHP?

When opening multiple pages in a frame based on a countdown in PHP, it is best practice to use JavaScript to handle the countdown and dynamically update the frame's content. This can be achieved by setting up a timer in JavaScript that triggers a function to change the frame's source URL when the countdown reaches zero.

<!DOCTYPE html>
<html>
<head>
    <title>Countdown Page</title>
</head>
<body>
    <h1>Countdown Page</h1>
    <p id="countdown">5</p>
    <iframe id="contentFrame" width="800" height="600"></iframe>

    <script>
        var countdown = 5;
        var contentFrame = document.getElementById('contentFrame');
        
        var timer = setInterval(function() {
            countdown--;
            document.getElementById('countdown').innerText = countdown;

            if(countdown === 0) {
                clearInterval(timer);
                contentFrame.src = 'page1.php'; // Change the URL to the desired page
            }
        }, 1000);
    </script>
</body>
</html>