Netscape Plugin Application Programming Interface (NPAPI) was an
application programming interface (API) of the web browsers that allows
plugins to be integrated.
Initially developed for
Netscape browsers, starting in 1995 with
Netscape Navigator
Netscape Navigator was a web browser, and the original browser of the Netscape line, from versions 1 to 4.08, and 9.x. It was the flagship product of the Netscape Communications Corp and was the dominant web browser in terms of usage share in ...
2.0, it was subsequently adopted by other browsers.
In 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 computer software for viewing multimedia contents, executing rich Internet applications, and streaming audio and video content created on the ...
and
Microsoft Silverlight
Microsoft Silverlight is a discontinued application framework designed for writing and running rich web applications, similar to Adobe's runtime, Adobe Flash. A plugin for Silverlight is still available for a very small number of browsers. W ...
, as well as platforms for web applications such as the
Java Runtime Environment
Java is a set of computer software and specifications developed by James Gosling at Sun Microsystems, which was later acquired by the Oracle Corporation, that provides a system for developing application software and deploying it in a cros ...
.
NPAPI support among major browsers started to wane since 2015 and it was gradually deprecated over the following 7 years.
With the advent of
HTML5
HTML5 is a markup language used for structuring and presenting content on the World Wide Web. It is the fifth and final major HTML version that is a World Wide Web Consortium (W3C) recommendation. The current specification is known as the HTML ...
, all major web browsers have removed support for 3rd party NPAPI plugins for security reasons.
Scripting support
Scripting is a feature allowing
JavaScript
JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of websites use JavaScript on the client side for webpage behavior, of ...
code in a web page to interact with the plugin. Various versions of Netscape and then
Mozilla
Mozilla (stylized as moz://a) is a free software community founded in 1998 by members of Netscape. The Mozilla community uses, develops, spreads and supports Mozilla products, thereby promoting exclusively free software and open standards, w ...
supported this feature using different technologies, including LiveConnect, XPConnect, and NPRuntime.
LiveConnect
LiveConnect is a feature of Web browsers that allows
Java
Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's mos ...
and JavaScript software to intercommunicate within a Web page. 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 to access Java runtime libraries, much as applets can.
LiveConnect was used in
Netscape 4
Netscape Communicator (or ''Netscape 4'') is a discontinued Internet suite produced by Netscape Communications Corporation, and was the fourth major release in the Netscape line of browsers. It was first in beta in 1996 and was released in June ...
to implement 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
Java is a set of computer software and specifications developed by James Gosling at Sun Microsystems, which was later acquired by the Oracle Corporation, that provides a system for developing application software and deploying it in a cros ...
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 (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's mos ...
class and expose an
instance of it. The class could be called from JavaScript and from
Java applet
Java applets were small applications written in the Java programming language, or another programming language that compiles to Java bytecode, and delivered to users in the form of Java bytecode. The user launched the Java applet from a ...
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 translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily used for programs tha ...
, and implement native
methods
Method ( grc, μέθοδος, methodos) literally means a pursuit of knowledge, investigation, mode of prosecuting such inquiry, or system. In recent centuries it more often means a prescribed process for completing a task. It may refer to:
*Scien ...
. Handling
strings,
exceptions, and other Java
objects
Object may refer to:
General meanings
* Object (philosophy), a thing, being, or concept
** Object (abstract), an object which does not exist at any particular time or place
** Physical object, an identifiable collection of matter
* Goal, an ...
from
C++
C++ (pronounced "C plus plus") is a high-level general-purpose programming language created by Danish computer scientist Bjarne Stroustrup as an extension of the C programming language, or "C with Classes". The language has expanded significan ...
is non-obvious. In addition, LiveConnect uses an earlier and now obsolete
application programming interface (API) for invoking native C++ calls from Java, called JRI. The JRI technology has long since been supplanted by
JNI
In software design, the Java Native Interface (JNI) is a foreign function interface programming software framework, framework that enables Java (programming language), Java code running in a Java virtual machine (JVM) to call and be called by
n ...
.
XPConnect
XPConnect (Cross Platform Connect) is a technology which enables simple interoperation between
XPCOM Cross Platform Component Object Model (XPCOM) is a cross-platform component model from Mozilla. It is similar to Microsoft Component Object Model (COM) and Common Object Request Broker Architecture (CORBA). It features multiple language bindings ...
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
The HyperText Markup Language or HTML is the standard markup language for documents designed to be displayed in a web browser. It can be assisted by technologies such as Cascading Style Sheets (CSS) and scripting languages such as JavaSc ...
/
XHTML
Extensible HyperText Markup Language (XHTML) is part of the family of XML markup languages. It mirrors or extends versions of the widely used HyperText Markup Language (HTML), the language in which Web pages are formulated.
While HTML, prior ...
/
XUL
XUL ( ), which stands for XML User Interface Language, is a user interface markup language developed by Mozilla. XUL is an XML dialect for writing graphical user interfaces, enabling developers to write user interface elements in a manner sim ...
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
XMLHttpRequest (XHR) is an API in the form of an object whose methods transfer data between a web browser and a web server. The object is provided by the browser's JavaScript environment. Particularly, retrieval of data from XHR for the purpos ...
object), the usual security restrictions can also be found (e.g. cannot open
URLs
A Uniform Resource Locator (URL), colloquially termed as a web address, is a reference to a web resource that specifies its location on a computer network and a mechanism for retrieving it. A URL is a specific type of Uniform Resource Identifi ...
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
An enumeration is a complete, ordered listing of all the items in a collection. The term is commonly used in mathematics and computer science to refer to a listing of all of the elements of a set. The precise requirements for an enumeration (fo ...
.
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
The fragile base class problem is a fundamental architectural problem of object-oriented programming systems where base classes ( superclasses) are considered "fragile" because seemingly safe modifications to a base class, when inherited by the ...
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.
Support
Because of the age of the API, security issues, and adoption of alternative technologies such as
HTML5
HTML5 is a markup language used for structuring and presenting content on the World Wide Web. It is the fifth and final major HTML version that is a World Wide Web Consortium (W3C) recommendation. The current specification is known as the HTML ...
, 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 IE or MSIE) is a series of graphical web browsers developed by Microsoft which was used in the Windows line of operating systems ( ...
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
ActiveX is a deprecated software framework created by Microsoft that adapts its earlier Component Object Model (COM) and Object Linking and Embedding (OLE) technologies for content downloaded from a network, particularly from the World Wide We ...
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 ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, w ...
version of Chrome 35 and later. In April 2015, Chrome for
Windows
Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for ser ...
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 theatre in which music is a fundamental component and dramatic roles are taken by singers. Such a "work" (the literal translation of the Italian word "opera") is typically a collaboration between a composer and a libr ...
dropped support with version 37 in May 2016.
Firefox
Mozilla
Firefox
Mozilla Firefox, or simply Firefox, is a free and open-source web browser developed by the Mozilla Foundation and its subsidiary, the Mozilla Corporation. It uses the Gecko rendering engine to display web pages, which implements current ...
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 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
SeaMonkey is a free and open-source Internet suite. It is the continuation of the former Mozilla Application Suite, based on the same source code, which itself grew out of Netscape Communicator and formed the base of Netscape 6 and Netscape ...
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
A web browser is application software for accessing websites. When a user requests a web page from a particular website, the browser retrieves its files from a web server and then displays the page on the user's screen. Browsers are used on ...
support all NPAPI plugins:
*
360 Secure Browser
360 Secure Browser (360 Security Browser) or 360 Safe Browser () is a web browser developed by the Qihoo company of Beijing, China. It was first released in September 2008.
The browser by default renders the webpage using the WebKit-based engi ...
() or 360 Extreme Explorer ( zh, 360极速浏览器)
*
Basilisk
In European bestiaries and legends, a basilisk ( or ) is a legendary reptile reputed to be a serpent king, who causes death to those who look into its eyes. According to the ''Naturalis Historia'' of Pliny the Elder, the basilisk of Cyrene i ...
*
K-Meleon
K-Meleon is a free and open-source, lightweight web browser for Microsoft Windows. Unlike cross-platform browsers, it uses the native Windows API to create its user interface. K-Meleon can use the secure Goanna layout engine based on Mozilla's ...
(
Goanna
A goanna is any one of several species of lizards of the genus '' Varanus'' found in Australia and Southeast Asia.
Around 70 species of ''Varanus'' are known, 25 of which are found in Australia. This varied group of carnivorous reptiles ranges ...
engine)
*
Pale Moon
Pale Moon is an open-source web browser with an emphasis on customization; its motto is "Your browser, Your way". There are official releases for Microsoft Windows and Linux, as well as contributed builds for various platforms.
Pale Moon origi ...
(Pale Moon future
roadmap
A roadmap may refer to:
*A road map, a form of map that details roads and transport links
*A plan, e.g.
**Road map for peace, to resolve the Israeli-Palestinian conflict
**Technology roadmap
A technology roadmap is a flexible planning schedule ...
)
*
Uzbl
Uzbl is a discontinued free and open-source minimalist web browser designed for simplicity and adherence to the Unix philosophy. Development began in early 2009 and is still considered in alpha software by the developers. The core component of Uz ...
*
Waterfox
Waterfox is an open-source web browser that is forked from Firefox and developed by System1. There are official Waterfox releases for Windows, macOS, and Linux.
Divisions
Waterfox
Waterfox shares core features and technologies like the Gecko b ...
(Allowing running NPAPI plugins but only the 64-bit one)
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 se ...
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 theatre in which music is a fundamental component and dramatic roles are taken by singers. Such a "work" (the literal translation of the Italian word "opera") is typically a collaboration between a composer and a libr ...
and
Vivaldi
Antonio Lucio Vivaldi (4 March 1678 – 28 July 1741) was an Italian composer, virtuoso violinist and impresario of Baroque music. Regarded as one of the greatest Baroque composers, Vivaldi's influence during his lifetime was widesprea ...
added PPAPI plugin support.
In February 2012
Adobe Systems 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
The Netscape Server Application Programming Interface (NSAPI) is an application programming interface for extending server software, typically web server software.
History
NSAPI was initially developed by Rob McCool at Netscape for use in Netsc ...
(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
Application programming interfaces
Software add-ons
Web browsers
__FORCETOC__