NPAPI
   HOME

TheInfoList



OR:

Netscape Plugin Application Programming Interface (NPAPI) was an
application programming interface An application programming interface (API) is a way for two or more computer programs to communicate with each other. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how ...
(API) of the web browsers that allows plugins to be integrated. Initially developed for
Netscape Netscape Communications Corporation (originally Mosaic Communications Corporation) was an American independent computer services company with headquarters in Mountain View, California and then Dulles, Virginia. Its Netscape web browser was on ...
browsers, starting in 1995 with Netscape Navigator 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 ...
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. ...
, 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. With the advent of HTML5, 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, ...
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 mo ...
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 to implement scriptability of NPAPI plugins. The
Open Java Interface 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 ...
-dependent implementation of LiveConnect was removed from the Mozilla source code tree in late June 2009 as part of th
Mozilla 2
cleanup 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 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 ...
-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 mo ...
class Class or The Class may refer to: Common uses not otherwise categorized * Class (biology), a taxonomic rank * Class (knowledge representation), a collection of individuals or objects * Class (philosophy), an analytical concept used differently ...
and expose an instance of it. The class could be called from JavaScript and from Java applets 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 ai ...
from C++ is non-obvious. In addition, LiveConnect uses an earlier and now obsolete
application programming interface An application programming interface (API) is a way for two or more computer programs to communicate with each other. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how ...
(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 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 Interface or interfacing may refer to: Academic journals * ''Interface'' (journal), by the Electrochemical Society * '' Interface, Journal of Applied Linguistics'', now merged with ''ITL International Journal of Applied Linguistics'' * '' Int ...
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 JavaS ...
/
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 Identi ...
of other domains). Mozilla was already using XPCOM to define the
interfaces Interface or interfacing may refer to: Academic journals * ''Interface'' (journal), by the Electrochemical Society * '' Interface, Journal of Applied Linguistics'', now merged with ''ITL International Journal of Applied Linguistics'' * '' Int ...
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 In computer science, reference counting is a programming technique of storing the number of references, pointers, or handles to a resource, such as an object, a block of memory, disk space, and others. In garbage collection algorithms, refer ...
, 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 Dynamic-link library (DLL) is Microsoft's implementation of the shared library concept in the Microsoft Windows and OS/2 operating systems. These libraries usually have the file extension DLL, OCX (for libraries containing ActiveX controls) ...
(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 (; ) is an overland journey to observe wild animals, especially in eastern or southern Africa. The so-called "Big Five" game animals of Africa – lion, leopard, rhinoceros, elephant, and Cape buffalo – particularly form an impor ...
.


Support

Because of the age of the API, security issues, and adoption of alternative technologies such as HTML5, 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 (in ...
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 Shim may refer to: * Shim (spacer), a thin and often tapered or wedged piece of material ** CPU shim, a spacer for a computer heat sink ** Shim (fencing), a device used in the sport fencing ** Shim (lock pick), a tool used to bypass padlocks * Sh ...
between ActiveX and the NPAPI plugin. Microsoft dropped support in version 5.5 SP2 onwards for security reasons.


Google Chrome

Google Chrome Google Chrome is a cross-platform web browser developed by Google. It was first released in 2008 for Microsoft Windows, built with free software components from Apple WebKit and Mozilla Firefox. Versions were later released for Linux, macOS, ...
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, whi ...
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 se ...
and
OS X macOS (; previously OS X and originally Mac OS X) is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac computers. Within the market of desktop and la ...
(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 A safari (; ) is an overland journey to observe wild animals, especially in eastern or southern Africa. The so-called "Big Five" game animals of Africa – lion, leopard, rhinoceros, elephant, and Cape buffalo – particularly form an impor ...
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 Cyre ...
* K-Meleon (
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 future roadmap) *
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 plugin execution. PPAPI was initially only supported by Google Chrome and
Chromium Chromium is a chemical element with the symbol Cr and atomic number 24. It is the first element in group 6. It is a steely-grey, lustrous, hard, and brittle transition metal. Chromium metal is valued for its high corrosion resistance and hard ...
. 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 Adobe Inc. ( ), originally called Adobe Systems Incorporated, is an American multinational computer software company incorporated in Delaware and headquartered in San Jose, California. It has historically specialized in software for the cre ...
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 Oliphant

Nixysa: 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__