I have some jQuery code which will be executed every 6 seconds.
With Mozilla Firefox 51.0.1 it works fine. With Internet Explorer 11 it seems to be working just fine, but when I leave my computer, do something else, and come back, it is possible that Internet Explorer 11 has stopped running the script. For example, after several hours. In other words, it will not be executed every 6 seconds anymore. There are no error messages available.
How could I solve the problem?
<script src="/jquery-3.0.0.min.js"></script>
<script type="text/javascript">
<!--
$(document).ready(function(){
valvonta = function() {
var kaavio = 106; // 38;
var a = performance.now();
jQuery.post("hae_tilanteet.php", {
kaavio: kaavio
}).done(function(data) {
var b = performance.now();
$('#valvonta').html(data);
var c = performance.now();
// alert('search ' + (((b - a)/1000)%60) + ' s and update ' + (((c - b)/1000)%60) + ' s');
setTimeout(valvonta, 6000);
});
};
setTimeout(valvonta, 6000);
});
//-->
</script>