Google To Integrate Long Task API To Find Delays On Unresponsive Webpages In Chrome

Every once in a while we come across website error that causes browsers to become unresponsive. The reason behind the failure is mostly due to the combined loading time that is taken by the device and web server to run a faulty JavaScript code. Given the reoccurrence of this error on every browser, Google is working on a solution for its own Chrome browser. To overcome the failure, Google is planning to integrate the Long Task API in Chrome.

With Long Task API in action, web apps will be able to highlight the incorrect code that is causing the unresponsiveness. The highlighted problem will then be reported to the developers so that they can fix it. The Long Task API will identify pages that take more than 50 milliseconds to load; it will then find out the inception of the process and report it for fixation.

Google plans on integrating the new setup in next update to Chrome for Desktop. It will also take care of the unwanted power used by tabs running in background, which is already present on Chrome for Android. The new Long Task API will be integrated into the browser by default so that Chrome can load pages faster without any error. The new method will help in finding out if there is an error in web elements like AD favicon, video embed code, or others.

“The major culprit behind these responsiveness issues is main thread contention, which in turn is caused by ‘long tasks’. Long tasks monopolise the UI thread for extended periods of time and block other critical tasks from being executed – for instance reacting to input,” the search giant said in the Google Group for Blink Dev (Chromium).

In most of the cases, the issue is mainly related to the third-party elements found on the web page. In the modern times, the websites have become interactive and are filled with numerous foreign elements and content such as automated video playback, advertisements, GIFs, and much more. The fault in the code of these elements often slows down the website and it makes the browser unresponsive.

In a blog post on GitHub, the browser unresponsive has been described as:

To the user this is commonly visible as a “locked up” page where the browser is unable to respond to user input; this is a major source of bad user experience on the web today:

Delayed “time to Interactive”: while the page is loading long tasks often tie up the main thread and prevent the user from interacting with the page even though the page is visually rendered. Poorly designed third-party content is a frequent culprit.

High/variable event handling latency: similar to input, but for processing event callbacks (e.g. onload events, and so on), which delay application updates.

Janky animations and scrolling: some animation and scrolling interactions require coordination between compositor and main threads; if the main thread is blocked due to a long task, it can affect responsiveness of animations and scrolling.

With the inclusion of Long Task API in Chrome, it would be interesting to see how it helps in fixing the page responsiveness and providing a better web experience.