Reloading

I'm using the following script, I need to reload it every 60 secondes.
How should I do this?
Thanks


<script type='text/javascript'><!--//<![CDATA[
   document.MAX_ct0 ='{clickurl}';

   var m3_u = (location.protocol=='https:'?'https://ads.a7fr.com/www/delivery/ajs.php':'http://ads.a7fr.com/www/delivery/ajs.php');
   var m3_r = Math.floor(Math.random()*99999999999);
   if (!document.MAX_used) document.MAX_used = ',';
   document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u);
   document.write ("?zoneid=3");
   document.write ('&amp;cb=' + m3_r);
   if (document.MAX_used != ',') document.write ("&amp;exclude=" + document.MAX_used);
   document.write ("&amp;loc=" + escape(window.location));
   if (document.referrer) document.write ("&amp;referer=" + escape(document.referrer));
   if (document.context) document.write ("&context=" + escape(document.context));
   if ((typeof(document.MAX_ct0) != 'undefined') && (document.MAX_ct0.substring(0,4) == 'http')) {
       document.write ("&amp;ct0=" + escape(document.MAX_ct0));
   }
   if (document.mmm_fo) document.write ("&amp;mmm_fo=1");
   document.write ("'></scr"+"ipt>");
//]]>--></script>
cabouAsked:
Who is Participating?
 
ravs120499Commented:
You can use the setTimeout and setInterval functions in a loop. setTimeout is not a blocking call, and hence is not equivalent to the sleep() function in most other languages. You will need to write code to keep the script "occupied doing nothing" until the timeout event is notified. Not ideal, but no other option in Javascript.

Alternatively you can use the Refresh meta to get the browser to reload the page every n seconds. But this will trigger a refresh in the browser and a call to the server.
<META HTTP-EQUIV="refresh" CONTENT="3">

- Ravs
0
 
Michel PlungjanIT ExpertCommented:
Put the script in a piece of html in an iframe and reload the iframe

<html>
<head>
function reloadIf() {
  window.frames[0].location.reload(1);
}
var tId = "";
</script>
</head>
<body>
<iframe src="ad.html" onLoad="parent.tId=setInterval('parent.reloadIf()',60000)"></iframe>
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.