views:

23

answers:

0

There is a few questions about this, but mostly lacking details and no definitive answer.

So I am using xhr long polling, my poll is pretty basic and just looks like

var poll = function() { 
  $.get(url, function(data) {
    doStuff(data);
    poll(); 
  });
};

I start that from a script that is imported just before , I remove absolutely everything else on the page so the only thing that is loaded in javascript (synchronously), I then wrap the call in

window.onload = function () { 
   setTimeout(poll, 0);
};

However webkit still gives me a constantly loading url bar, I can change 0 to some arbitrary number to fix it, however I would really like a consistent way to never see this issue again.

Anyone have any ideas? I have tried various other techniques to wait for loading, checking in web inspector shows the file that contains runs the above js is the last thing to load before the poll starts, and the last line of that file is the })(); that executes the whole thing.