One thing you can do to is to put in the first html page some javascript code that (after a timeout) redirects to a cgi script that will produce the second page.
Why do you need javascript, or CGI for that matter? The following HTML in the <HEAD> element should cause the page to refresh itself every 5 seconds (assuming the page is located at /my.htm).