Ajax calls on Vivaldi take increasingly longer time until page is reloaded

82 views Asked by At

In my Javascript/jQuery app, I make an Ajax call like this:

var t1 = new Date().getTime();
$(target).load(url,function() {
  var t2 = (new Date().getTime() - t1) / 1000;
  console.log("ajax call took "+t2+" secs")
});

In the Vivaldi browser, the call takes increasingly longer each time I call the code:

ajax call took 0.917 secs
ajax call took 1.013 secs
ajax call took 1.179 secs
ajax call took 1.263 secs
ajax call took 1.3 secs
ajax call took 1.668 secs
...

...until it takes several seconds.

When I manually refresh the page, the time seems to be reset.

The problem is not on the server side, as the time consumed by the server side code does not vary.

Also, this does not happen on Chrome, Firefox or Edge.

Any suggestions?

1

There are 1 answers

0
Arne M On

I think I have found the real source of the problem. Prior to calling .load(), I push the url onto the browser's session history stack. I omitted this line in my code here for clarity, but now it seems like this is the source of the problem:

window.history.pushState({url:url}, null, url);
var t1 = new Date().getTime();
...

If I comment out the pushState() line, the timing of the ajax call is constant, as expected.

Again, this only happens on Vivaldi, and it seems to be a real problem here.