title: Online Quiz: how can I avoid timer getting refreshed when user click on refresh button in the browser toolbar/Status Bar?
body: <pre><code>  htmlTable.Append("&lt;script&gt; var seconds = " + ttime + "; function secondPassed() { var minutes = Math.round((seconds - 30) / 60);  var remainingSeconds = seconds % 60; if (remainingSeconds &lt; 10) { remainingSeconds = '0' + remainingSeconds;  } document.getElementById('countdown').innerHTML = 'Time Left :- ' + minutes + ':' + remainingSeconds; if (seconds == 0) { clearInterval(countdownTimer);document.getElementById('Button1').click(); } else  { seconds--; } } var countdownTimer = setInterval('secondPassed()', 1000);&lt;/script&gt;");
          PlaceHolder1.Controls.Add(new Literal { Text = htmlTable.ToString() });
  </code></pre>
  
  <p>The above code is used to create a timer in .aspx.cs file. It's an online exam application.</p>