The Chrome browser is experiencing delays with processing ajax requests, causing them

When I make a series of 8 requests in quick succession, they load successfully. However, any requests made after that get stuck in a "pending" state.

Below is my basic HTML template:

<!DOCTYPE html>
<html>
  <head>
    <meta charset='utf-8'>
    <title>Editing Quiz</title>
    <script src="../assets/js/lib.js"></script>
  </head>
  <body>
    <div>
      <a href="#/test">test</a>
      <a href="#/demos/QuizDemo">QuizDemo</a>
    </div>
    <div id="container">
    </div>
  </body>
</html>

Here are the relevant parts of my lib.js file:

function loadPage(e) {
    document.getElementById("container").innerHTML = "";
    var baseFilename = location.hash.substr(1);
    var url = "/LiquiZ2" + baseFilename + "_ajax.jsp"; // name of dynamic file to run

    var json = new XMLHttpRequest();
    json.onreadystatechange=function() {
      if (json.readyState!==4 || json.status!==200)
          return;
      processAJAX(json.responseText);
    }
    json.open("GET", url, true);
    json.send();
}

window.onload = loadPage;
window.onhashchange = loadPage;

When I rapidly click on "test" and "QuizDemo" consecutively or with a few seconds in between, the loading stops after 8 requests and enters a pending state. Subsequent requests also get stalled and do not recover.

This behavior functions flawlessly in Firefox, so it's unclear why there is an issue elsewhere.

Answer №1

The issue I encountered stemmed from the presence of video elements on my webpage. Chrome's default behavior is to start loading videos automatically, but it does so in chunks, meaning they are never fully loaded until the entire video is watched. Consequently, when new data was loaded onto the page, the video requests would get stuck in a state of limbo.

To overcome this challenge, I implemented a global list named media. Whenever I created an element that included a stream (such as audio or video), I would add it to the media list. Then, upon refreshing the page, I simply looped through the media list and executed media[i].removeAttribute("src"), followed by media[i].load(). This process essentially attempted to reload the stream, thereby aborting all previous requests automatically. Additionally, if the source (src) was missing, the load failure occurred without any visible errors.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Optimizing Angular for requireJS deletion

We recently developed an Angular directive that utilizes blueimp-fileupload. Everything seems to be working fine until we decided to optimize our code using requireJs. After running the optimizer, we encountered the following error: Error: cannot call m ...

I'm looking for the best way to send POST data to an API with Meteor's HTTP package

Here's my current code snippet: HTTP.post("http://httpbin.org/post", {}, function(error, results) { if (results) { console.log(results); } else { console.log(error) } ...

Dynamically retrieving markers from the database based on the most recent timestamp of the last loaded batch

I currently have a database where I store marker locations along with their latitude, longitude, type, and timestamp. Right now, my code loads all markers from the database and displays them on the map with different icons based on their type. However, w ...

Issue TS8011 in Angular 6 is related to the restriction on using type arguments only in files with the .ts extension

I have a project in Angular 6 where I need to integrate a JS library. This library is confidential, so I can't disclose its details. The problem I'm facing is that the TypeScript compiler seems to misinterpret characters like <<24>>, ...

AngularJS seems to be failing to display the initial option in the input select field

When using Angularjs, binding an input select to the model results in a new empty option being created <option value="? undefined:undefined ?"></option> Here is an example of the code: <select name="category" ng-model="hotspot.category"&g ...

Repeated module imports

Currently, as part of my app development process, I am utilizing Parcel along with @material-ui/styles. One crucial aspect to note is that my app has a dependency on the @material-ui/styles package. Additionally, I have incorporated my own npm package, sto ...

Reordering sections in a dynamic manner

I'm working on a single-page website with four sections arranged like this: <section id=“4”> <section id=“3”> <section id=“2”> <section id=“1”> Now, I want to change the order of these sections when scrolling ...

Return to the initial stage of a multistep process in its simplest form following a setTimeout delay

I recently customized the stepsForm.js by Copdrops and made some modifications. Although everything works well, I'm struggling to navigate back to the initial step (first question) after submitting the form due to my limited knowledge of JavaScript. ...

Unable to smoothly animate object within OBJLoader

I'm a beginner in the world of Three JS and Tween JS, having recently picked it up for my project. However, I've encountered some frustration along the way. My main issue at the moment is trying to tween object1, amidst other objects like object2 ...

Extracting and retrieving information from a complex data structure obtained through an API call

Struggling with this one. Can't seem to locate a similar situation after searching extensively... My goal is to determine the author of each collection associated with a user. I wrote a function to fetch data from an API for a specific user, in this ...

"Dynamic value changes in bootstrap multiselect dropdowns triggered by selection in another multiselect dropdown

I am trying to enhance the functionality of my multiselect dropdown in Bootstrap by updating the values based on another multiselect selection. Currently, the code works well with one selection, but as soon as I include the class="selectpicker", ...

React function does not provide a return value

In my function, I am calculating the current sum of elements. Within my Api, there is a method called Getcoin that works correctly when I log each element during the foreach cycle. However, I am not getting any results in the return statement or console.lo ...

Effects of jQuery Show / Hide on adjacent select box operations

I created a pair of select boxes where the visibility of one is controlled by the other. Initially, the controlled select box (#select02) works perfectly on page load as long as I don't show/hide it by selecting options in the controlling select box ( ...

Tips for managing nested objects within React state and keeping them updated

Could someone kindly point out where I might be going wrong with this code? Upon checking the console.log, it seems like the date function is functioning correctly. However, despite using this.setState, the timestamp remains unchanged. Any help would be gr ...

Exploring the process of retrieving MongoDB documents with methods such as findOne() or find() in Node.js, particularly when the models and schema are contained in a separate file

As someone who is new to node, MongoDB, and coding in general, I'm currently working on a project involving the creation and storage of documents in MongoDB using Mongoose. Initially, all my models and schemas were housed in the app.js file, allowing ...

Steps for eliminating an element using jQuery from a variable filled with HTML code

I'm developing a forum where users have the ability to quote other users' comments. When a user clicks on "quote" for a comment, it captures the HTML of that comment and displays it in a box that says Quote: Original post by a member, similar t ...

Refresh the database values every five minutes

I am currently developing a web application that assigns users a ranking based on their activity on Twitter and on my website. For this reason, I want to update their rank every five minutes by retrieving their latest Twitter activity and updating it in m ...

Having issues with the functionality of Bootstrap 4 popover?

In my Spring MVC web project, a Bootstrap popover appears when the help icon is clicked. However, on the first click, the popover opens and moves away from the icon. After closing it and clicking again, the popover correctly positions itself. When I chan ...

Display the appropriate selection choices based on the knockout condition

In my HTML page, there is a dropdown with certain conditions that determine which options should be rendered in the select element. My attempt at achieving this: <select> <!-- ko if: condition() --> <option value="1">1& ...

Using the $ sign to choose a subdocument in mongoose

Here is the structure of my document: "event": { "attendants": { "seekers": [ { "$oid": "5bcdabd27e51de001576d289" }, { "$oid": "5bc9b39c1a48dd0d7d521924" } ...