1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

jQuery and setTimeout stops working on Internet Explorer 11

Discussion in 'jQuery' started by xms, May 4, 2017.

  1. #1
    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">
      valvonta = function() {
        var kaavio = 106; // 38;
        var a = performance.now();
        jQuery.post("hae_tilanteet.php", {
          kaavio: kaavio
        }).done(function(data) {
          var b = performance.now();
          var c = performance.now();
          // alert('search ' + (((b - a)/1000)%60) + ' s and update ' + (((c - b)/1000)%60) + ' s');
          setTimeout(valvonta, 6000);
      setTimeout(valvonta, 6000);
    Code (JavaScript):
    xms, May 4, 2017 IP
  2. xms

    xms Active Member

    Likes Received:
    Best Answers:
    Trophy Points:
    I guess that my problem has something to do with this issue:


    So, how could I modify my original code?
    xms, May 4, 2017 IP