Google Chrome Browser Adds New Native Messaging API for Developers

The new API will help developers and users cope with the planned demise of the old NPAPI from Chrome that will start in January 2014.


Google is adding a new Native Messaging API to its Chrome Web browser to replace the capabilities of a formerly popular Netscape-era NPAPI Web browser plug-in that will no longer be supported starting in January 2014.

In September, the Chrome team announced that support for the old Netscape Plug-in API (NPAPI) is being dropped in Chrome browsers because it isn't used or supported on mobile devices and because the Mozilla Foundation is also planning to block NPAPI plug-ins in the Firefox browser starting in December 2013, according to Google.

With the demise of NPAPI, some kind of support was still needed by some apps, so the Chrome team chose to add a new Native Messaging API to fill the gap, wrote Sergey Ulanov, a Google software engineer, in an Oct. 15 post on the Chromium Blog.

"We recently announced the deprecation of NPAPI plug-in support in Chrome," wrote Ulanov. "One of the main use cases for NPAPI plug-ins in Chrome apps and extensions was to connect with native applications installed on the same computer. For example, a native password management application that a user has already installed on the system may want to connect with a Chrome extension to synchronize passwords. To support such use cases without the need for NPAPI, we've recently added the Native Messaging API."

The Native Messaging API is available on Windows, OS X and Linux starting from Chrome 29, wrote Ulanov. Developers can also use other NPAPI alternatives as outlined on the NPAPI deprecation Chromium wiki page, he wrote. "For details on how to create and register a native messaging host, please refer to the API documentation and check out our sample application, which also includes a simple native messaging host."

Developers who want to use the new API must register their native applications with a native messaging host that Chrome apps and extensions can connect to, according to Ulanov. "This is done by installing a special manifest file that defines a name and path to the native messaging host binary, as well as set of app and extension IDs that can connect to it. Once a native messaging host manifest is installed, Chrome apps and extensions can connect to it using simple API."

The old Netscape Plug-in API ushered in an early era of Web innovation in early browsers and has been very important in Web apps for years, but that has become less so as users move to mobile devices that don't support the old API.

Another benefit of moving away from the NPAPI, according to Google, is that NPAPI's '90s-era architecture has become a leading cause of hangs, crashes, security incidents and code complexity with today's browsers.

A Chrome team analysis of anonymous Chrome usage data recently found that only six NPAPI plug-ins were being employed by more than 5 percent of users nowadays, according to Google. The first stage of the demise of NPAPI from Chrome will begin in January 2014 when Chrome will block Web page-instantiated NPAPI plug-ins by default on the Stable channel. Some of the most popular NPAPI plug-ins will be temporarily whitelisted during a transition period.

Included in the temporary whitelist are Silverlight, which was launched by 15 percent of Chrome users last month; Unity, launched by 9.1 percent of users; Google Earth, launched by 9.1 percent of users; Java, launched by 8.9 percent of users; Google Talk, launched by 8.7 percent of users; and Facebook Video, launched by 6 percent of users, according to Google.

As part of the transition, the Chrome Web Store is also phasing out NPAPI support.

Launched in 2008, Chrome presently holds 40.7 percent of the global Web browser market, compared with 28.6 percent for its closest competitor, Microsoft's Internet Explorer, according to the latest global statistics available from StatCounter. Chrome celebrated its fifth birthday in early September, and by June 2012, it surpassed Microsoft's Internet Explorer as the world's most used browser for the first time.