Hello there,

I am having some problem with JavaScript's setTimeout() function.

The result I want to achieve is this:
Master page reloads the slave page every few seconds and the slave page redirects to the master page each time it's loaded. I know it's hard to comprehend why it's needed, but it is.

The problem I'm having is this:
The master page doesn't wait the given seconds to reload the slave page, but reloads it instantly. And the slave page does as it should and redirects to the master loop which by itself makes an endless loop of instantaneous redirections.

Master page javascript ($sid variable exists and is recognized):
<script type="text/javascript">
location.href = '?m=history&sid=$sid&a=refresh';

function timedRefresh(timeoutPeriod) {

Here, the function timedRefresh() is called on the master page html like so:
<body onload="timedRefresh(5000)">
As I understand, it should wait 5 seconds, load the slave page, which by itself redirects to the master page and the wait begins again. For some reason, it doesn't work like that.

The slave page works fine, you don't have to worry about that.

I would greatly appreciate any help.