Mark Tabor

Mark Tabor

  • 585
  • 2k
  • 460.7k

javascript page refresher function gives flicker on Internet

Dec 13 2019 3:19 AM
Hi I have a requirement to refresh the page for every two seconds i am using below code for it .
<script type="text/javascript">
function timedRefresh(timeoutPeriod) {
setTimeout(function () {
location.reload(true);
}, timeoutPeriod);
}
</script>
 
<meta name="viewport" content="width=device-width" />
<title>Index1</title>
<meta http-equiv="refresh" content="2" />
</head>
<body onload="JavaScript:timedRefresh(2000);>
 
it works well for Google chrome but it gives flicker on IE and firefox so how to fix it ? can somebody help me  

Answers (5)