Webpages can load faster with new Facebook-developed Chrome API

Get a free Techzine subscription!

Facebook has developed a new API for Google Chrome to help develop web pages that load quickly and are responsive at the same time. Currently, developers face a compromise between these factors.

The new API should solve a problem when loading pages with a lot of JavaScript elements. Developers always had to choose between two approaches. They can choose to load all JavaScript elements at once, keeping the total loading time as low as possible, but keeping the page unusable until loading has finished. The other option is to load the elements one by one and add short intervals in which the browser can respond to input from the user. This feels more responsive but extends the total load time.

isInputPending()

With the new API developed by Facebook, developers don’t have to make that tradeoff. The isInputPending API, as Facebook calls it, allows JavaScript to check whether a user has interacted with the page, without pausing to load JavaScript elements.

Blog post

In a blog post, Facebook developers Nate Schloss and Andrew Comminos elaborate on the underlying technology and show examples of how developers can implement the code.

Chrome 87

The API has been incorporated in version 87 of Chromium. This version is now widely available and contains several other changes to improve the speed of the browser.