I have a countdown timer and when ever I rapidly press f5 the timer freezes. im guessing this is because the page reloads before the setInterval. i'm looking for a way to reload the page and at the same time keep the timer running whats happening is the page reloads before the setInterval could even finish
<h3 style="color:#000000" align="center">
Time Remaining : <span id='timer'></span>
</h3>
<script type="text/javascript" src="jquery-1.11.3.min.js"></script>
<script>
//define your time in second
var c = localStorage.getItem("timer");
if(c == null)c = 3600;
var t;
timedCount();
function timedCount()
{
var hours = parseInt( c / 3600 ) % 24;
var minutes = parseInt( c / 60 ) % 60;
var seconds = c % 60;
var result = (hours < 10 ? "0" + hours : hours) + ":" + (minutes < 10 ? "0" + minutes : minutes) + ":" + (seconds < 10 ? "0" + seconds : seconds);
$('#timer').html(result);
if(c == 0 )
{
//setConfirmUnload(false);
//$("#quiz_form").submit();
window.location="logout.html";
}
c = c - 1;
localStorage.setItem("timer", c);
t = setTimeout(function()
{
timedCount()
},1000);
}
</script>