Netscape Plugin Application Programming Interface (NPAPI) is a
deprecated application programming interface
An application programming interface (API) is a connection between computers or between computer programs. It is a type of software Interface (computing), interface, offering a service to other pieces of software. A document or standard that des ...
(API) for web browser
plugins, initially developed for
Netscape Navigator 2.0 in 1995 and subsequently adopted by other browsers.
In the NPAPI architecture, a plugin declares
content types (e.g. "audio/mp3") that it can handle. When the browser encounters a content type it cannot handle natively, it loads the appropriate plugin, sets aside space within the browser context for the plugin to render and then streams data to it. The plugin is responsible for rendering the data. The plugin runs in-place within the page, as opposed to older browsers that had to launch an external application to handle unknown content types. NPAPI requires each plugin to implement and expose approximately 15 functions for initializing, creating, deleting and positioning plugin content. NPAPI also supports scripting, printing, full-screen plugins, windowless plugins and content streaming.
NPAPI was frequently used for plugins which required intensive, low-level performance such as video players, including
Adobe Flash Player
Adobe Flash Player (known in Internet Explorer, Firefox, and Google Chrome as Shockwave Flash) is a discontinuedExcept in China, where it continues to be used, as well as Harman for enterprise users. computer program for viewing multimedia ...
and
Microsoft Silverlight, as well as platforms for web applications such as the
Java Runtime Environment.
NPAPI support among major browsers started to wane since 2015 and it was gradually deprecated over the following 7 years. All major web browsers have removed support for 3rd party NPAPI plugins for security and maintenance reasons.
Scripting support
Scripting is a feature allowing
JavaScript
JavaScript (), often abbreviated as JS, is a programming language and core technology of the World Wide Web, alongside HTML and CSS. Ninety-nine percent of websites use JavaScript on the client side for webpage behavior.
Web browsers have ...
code in a web page to interact with the plugin. Various versions of Netscape and then
Mozilla supported this feature using different technologies, including LiveConnect, XPConnect, and NPRuntime.
LiveConnect
LiveConnect is a feature of Web browsers that allows
Java
Java is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea (a part of Pacific Ocean) to the north. With a population of 156.9 million people (including Madura) in mid 2024, proje ...
and JavaScript software to intercommunicate within a Web page. The first version of LiveConnect was built by an intern graduate student at Carnegie Mellon University (CMU). From the Java side, it allows an applet to invoke the embedded scripts of a page, or to access the built-in JavaScript environment, much as scripts can. Conversely, from the JavaScript side, it allows a script to invoke applet methods or access Java runtime libraries as much as applets can.
LiveConnect was used in
Netscape 4 to implement the scriptability of NPAPI plugins.
The
Open Java Interface-dependent implementation of LiveConnect was removed from the Mozilla source code tree in late June 2009 as part of th
Mozilla 2cleanup effort. It is no longer needed with the release of a redesigned
Java Runtime Environment from Sun Microsystems. However, the old implementation was restored for Gecko 1.9.2, as Apple had yet to port the newer JRE over to Mac OS X.
The Java–JavaScript functionality supported by the redesigned Java Runtime Environment is still called "LiveConnect", despite the
Open Java Interface-specific approach having been abandoned. With Netscape 4, NPAPI was extended to allow plugins to be scripted. This extension is called LiveConnect. A plugin could implement a
Java
Java is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea (a part of Pacific Ocean) to the north. With a population of 156.9 million people (including Madura) in mid 2024, proje ...
class and expose an
instance of it. The class could be called from JavaScript and
Java applet
Java applets were applet, small applications written in the Java (programming language), Java programming language, or another programming language that Compiled language, compiles to Java bytecode, and delivered to users in the form of Ja ...
s running within the page.
The disadvantage of LiveConnect is, that it is heavily tied to the version of Java embedded within the Netscape browser. This prevented the browser from using other Java runtimes and added bloat to the browser download size since it required Java to script plugins. Additionally, LiveConnect is tricky to program: The developer has to define a Java class for the plugin, run it through a specialized Java
header compiler
In computing, a compiler is a computer program that Translator (computing), translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primaril ...
, and implement native
methods. Handling
strings,
exceptions, and other Java
objects from
C++ is non-obvious. In addition, LiveConnect uses an earlier and now obsolete
application programming interface
An application programming interface (API) is a connection between computers or between computer programs. It is a type of software Interface (computing), interface, offering a service to other pieces of software. A document or standard that des ...
(API) for invoking native C++ calls from Java, called JRI. The JRI technology has long since been supplanted by
JNI.
XPConnect
XPConnect (Cross Platform Connect) is a technology which enables simple interoperation between
XPCOM and JavaScript.
Object connection
XPConnect allows JavaScript objects to transparently access and manipulate XPCOM objects. It also enables JavaScript objects to present XPCOM compliant
interfaces to be called by XPCOM objects. A main goal is that objects communicating from either side of an XPCOM style interface should not generally need to know or care about the implementation language of the object on the other side of the interface.
XPConnect's primary reason for existence is to replace handwritten code used in places where native code needs to interact with JavaScript code. An example is the
DOM module.
Security
Full privileges are only granted by default to chrome scripts, i.e. scripts that are part of the application or of an extension. For remote
HTML
Hypertext Markup Language (HTML) is the standard markup language for documents designed to be displayed in a web browser. It defines the content and structure of web content. It is often assisted by technologies such as Cascading Style Sheets ( ...
/
XHTML
Extensible HyperText Markup Language (XHTML) is part of the family of XML markup languages which mirrors or extends versions of the widely used HyperText Markup Language (HTML), the language in which Web pages are formulated.
While HTML, pr ...
/
XUL documents, most XPCOM objects are not accessible by the scripts as they have limited privileges due to security reasons. Even if they are accessible (e.g. the
XMLHttpRequest object), the usual security restrictions can also be found (e.g. cannot open
URLs of other
domains).
Mozilla was already using XPCOM to define the
interfaces to many objects implemented in C++. Each interface was defined by an
IDL file, and run through an IDL compiler that produced header files and a language-neutral type library that was a binary representation of the interface. This binary described the interface, the methods, the parameters, the data structures and
enumerations.
XPConnect uses the type library information to marshal calls between different thread contexts and between JavaScript and natively compiled C++. XPConnect is used extensively throughout Mozilla. Starting with Netscape 6.1 and Mozilla 0.9.2, NPAPI was extended, so that a plugin could return a scriptable interface to itself and XPConnect would marshal calls to it from JavaScript and the C++ implementation.
XPConnect has no Java dependency. However, the technology is based on XPCOM. Thus the plugin developer must be familiar with
reference counting, interfaces and IDL to implement scripting. The dependency on XPCOM led to certain dynamic linking issues (e.g. the
fragile base class problem) which had to be solved before the plugin would work correctly with different browsers. XPCOM has since been changed to supply a statically linked version to address such issues. This approach also requires an .xpt file to be installed next to the
dynamic-link library (DLL); otherwise the plugin appears to work, but the scripting does not, causing confusion.
NPRuntime
At the end of 2004, all major browser companies using NPAPI agreed on NPRuntime as an extension to the original NPAPI to supply scripting, via an API that is similar in style to the old C-style NPAPI and is independent of other browser technologies like Java or XPCOM. It is only supported by Firefox ESR (Extended Support Release) and
Safari
A safari (; originally ) is an overland journey to observe wildlife, wild animals, especially in East Africa. The so-called big five game, "Big Five" game animals of Africa – lion, African leopard, leopard, rhinoceros, African elephant, elep ...
.
Support
Because of the age of the API, security issues, and adoption of alternative technologies such as
HTML5
HTML5 (Hypertext Markup Language 5) is a markup language used for structuring and presenting hypertext documents on the World Wide Web. It was the fifth and final major HTML version that is now a retired World Wide Web Consortium (W3C) recommend ...
, many software vendors began to phase out NPAPI support in 2013.
Internet Explorer
Internet Explorer
Internet Explorer (formerly Microsoft Internet Explorer and Windows Internet Explorer, commonly abbreviated as IE or MSIE) is a deprecation, retired series of graphical user interface, graphical web browsers developed by Microsoft that were u ...
versions 3 through 5.5 SP2 supported NPAPI, allowing plugins that functioned in Netscape Navigator to function in Internet Explorer. Support came via a small
ActiveX control (named "
plugin.ocx
") that acted as a
shim between ActiveX and the NPAPI plugin. Microsoft dropped support in version 5.5 SP2 onwards for security reasons.
Google Chrome
Google Chrome permanently dropped all NPAPI support from all platforms in September 2015. In September 2013, Google announced that it would phase out NPAPI support in its Google Chrome browser during 2014, stating that "
ts90s-era architecture has become a leading cause of hangs, crashes, security incidents, and code complexity". In May 2014, NPAPI support was removed from the
Linux
Linux ( ) is a family of open source Unix-like operating systems based on the Linux kernel, an kernel (operating system), operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically package manager, pac ...
version of Chrome 35 and later. In April 2015, Chrome for
Windows and
OS X (versions 42 and later) disabled NPAPI support by default. However, until September 2015 (version 45), users could re-enable NPAPI.
Opera
Opera
Opera is a form of History of theatre#European theatre, Western theatre in which music is a fundamental component and dramatic roles are taken by Singing, singers. Such a "work" (the literal translation of the Italian word "opera") is typically ...
dropped support with version 37 in May 2016.
Firefox
Mozilla
Firefox release 52.0 in March 2017 removed all support for NPAPI except for Flash.
Meanwhile, the ESR channel retained general support for this feature with version 52 ESR being the last NPAPI resort. Firefox 69.0 disabled the Flash NPAPI by default. In Firefox 85.0, released in January 2021, NPAPI support was completely removed. In the ESR channel, support for Flash NPAPI ended with version 78.15.0, released in October 2021.
Safari
Safari
A safari (; originally ) is an overland journey to observe wildlife, wild animals, especially in East Africa. The so-called big five game, "Big Five" game animals of Africa – lion, African leopard, leopard, rhinoceros, African elephant, elep ...
has dropped support for all NPAPI plugins except for Flash with version 12 released in September 2018. Flash support has been removed from Safari 14, released in September 2020.
SeaMonkey
SeaMonkey stopped supporting NPAPI plugins from version 2.53.1, with the exception of Flash. NPAPI support was completely removed in SeaMonkey 2.53.7, released in March 2021.
Support
The following list of
web browsers support all NPAPI plugins:
*
360 Secure Browser () or 360 Extreme Explorer ( zh, 360极速浏览器)
*
Basilisk
In European bestiary, bestiaries and legends, a basilisk ( or ) is a legendary reptile reputed to be a Serpent symbolism, serpent king, who causes death to those who look into its eyes. According to the ''Natural History (Pliny), Naturalis Histo ...
*
K-Meleon (
Goanna engine)
*
Pale Moon (Pale Moon future
roadmap)
*
Uzbl
Similar technologies
ActiveX
Internet Explorer and
browsers based on Internet Explorer use ActiveX controls, ActiveX documents and ActiveX scripting to offer in-page extensibility on par with NPAPI. Although commonly associated with Internet Explorer, ActiveX is integration technology that allows any computer program to integrate parts of other computer programs that support such integration. Internet Explorer, however, is discontinued and its replacement, Microsoft Edge, does not support ActiveX.
PPAPI
On 12 August 2009 a page on Google Code introduced a new project called Pepper, with the associated Pepper Plugin API (PPAPI); PPAPI is a derivative of NPAPI aimed to make plugins more portable and more secure. This extension is designed specifically to ease the implementation of out-of-
process
A process is a series or set of activities that interact to produce a result; it may occur once-only or be recurrent or periodic.
Things called a process include:
Business and management
* Business process, activities that produce a specific s ...
plugin execution.
PPAPI was initially only supported by Google Chrome and
Chromium. Later, other Chromium-based browsers such as
Opera
Opera is a form of History of theatre#European theatre, Western theatre in which music is a fundamental component and dramatic roles are taken by Singing, singers. Such a "work" (the literal translation of the Italian word "opera") is typically ...
and
Vivaldi added PPAPI plugin support.
In February 2012
Adobe Systems
Adobe Inc. ( ), formerly Adobe Systems Incorporated, is an American software, computer software company based in San Jose, California. It offers a wide range of programs from web design tools, photo manipulation and vector creation, through to ...
announced that future Linux versions of Adobe Flash Player would be provided only via PPAPI. The previous release, Flash Player 11.2, with NPAPI support, would receive security updates for five years. In August 2016 Adobe announced that, contrary to their previous statement, it would again support the NPAPI Flash Player on Linux and keep releasing new versions of it.
In August 2020, Google announced that support for PPAPI would be removed from Google Chrome and Chromium in June 2022.
See also
*
Netscape Server Application Programming Interface (NSAPI)
References
External links
Plugin development documentation on Mozilla Developer Center, including the NPAPI API
– a replacement for plugin.ocx that was removed from Internet Explorer.
Book on Programming Netscape Plug-Ins by Zan OliphantNixysa: A glue code generation framework for NPAPI plugins. Apache 2.0 license.NPAPI Tutorial ''Building a Firefox Plugin''Part twoPart threePart four
{{Web interfaces
__FORCETOC__
Application programming interfaces
Software add-ons
Web browsers