||This article includes a list of references, but its sources remain unclear because it has insufficient inline citations. (October 2015)|
|This article needs additional citations for verification. (October 2015)|
Netscape Plugin Application Programming Interface (NPAPI) is an application programming interface (API) that allow plug-ins (more specifically, browser extensions) to be developed for web browsers. It was first developed for Netscape browsers, starting in 1995 with Netscape Navigator 2.0, but was subsequently adopted by other browsers.
In NPAPI architecture, a plugin declares content types (e.g. "audio/mp3") 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.
LiveConnect was used in Netscape 4 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 the 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 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 and implement the 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 (API) for invoking native C++ calls from Java, called JRI. The JRI technology has long since been supplanted by JNI.
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/XHTML/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 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.
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 supported by Mozilla (1.7.5+), Firefox, Safari, Opera and Chrome.
The following web browsers support NPAPI plugins:
- Firefox (Mozilla will phase out NPAPI support by the end of 2016, except for Flash Player. 64-bit Firefox for Windows does not have NPAPI support.)
- Isis (WebOS)
- Odyssey Web Browser (MorphOS)
The following web browsers support NPAPI but are discontinued:
The following browsers once supported NPAPI plugins, but have dropped support since:
- Google Chrome and Chromium: In September 2013, Google announced that it would phase out NPAPI support in Chrome during 2014 because "NPAPI's 90s-era architecture has become a leading cause of hangs, crashes, security incidents, and code complexity". NPAPI support was removed from the Linux version of Chrome 35 and later, in May 2014. In April 2015, Chrome for Windows and OS X (versions 42 and later) disabled NPAPI support by default, however, NPAPI support could be enabled in the settings. Google completely dropped NPAPI support from all platforms in Chrome 45, released in September 2015.
- Internet Explorer: NPAPI was supported in Internet Explorer versions 3 through 5.5 SP2, 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. However, Microsoft dropped support in version 5.5 SP2 and later for security reasons.
- Opera for Linux: NPAPI support for Linux was removed with Opera 24.
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 notoriously 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.
On 12 August 2009, a page on Google Code introduced a new project, Pepper, with the associated Pepper Plugin API (PPAPI); PPAPI is a derivatization 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. The goals of the project are to provide a framework for making plugins fully cross-platform. Topics considered include:
- Uniform semantics for NPAPI across browsers.
- Execution in a separate process from the renderer/browser.
- Standardize rendering using the browser's compositing process.
- Defining standardized events and 2D rasterization functions.
- Initial attempt at providing 3D graphics access.
- Plugin registry.
On 26 May 2011, Mozilla announced that it was "not interested in or working on Pepper at this time."
In February 2012, Adobe Systems announced that future Linux versions of Adobe Flash Player would be provided only via PPAPI, although the previous release, Flash Player 11.2, with NPAPI support, would receive security updates for five years.
- For technical details, see the Mozilla Developer Documentation on LiveConnect.
- Rhinohide home page.
- "442399 – remove LiveConnect from the tree". mozilla.org.
- "517355 – Restore OJI, Liveconnect and the JEP on the 1.9.2 branch on OS X". mozilla.org.
- "Release Notes for the Next-Generation Java™ Plug-In Technology (introduced in Java SE 6 update 10)". sun.com.
- "Scripting plugins". Mozilla Developer Network.
- "NPAPI Plugins in Firefox". Mozilla. Retrieved 2015-10-08.
- Google will start blocking most Netscape Plug-In API plug-ins in January 2014, will whitelist Silverlight, Unity & others". TechCrunch. 23 September 2013.
- "Google looks to drop Netscape Plugin API support in Chrome, starting with blocking most plugins in January 2014". The Next Web. 23 September 2013.
- "Update on NPAPI deprecation". Chromium Blog. 27 May 2014.
- "The final countdown for NPAPI". Chromium Blog. 24 November 2014.
- "Netscape-Style Plug-ins Do Not Work After Upgrading Internet Explorer". Support (3.3 ed.). Microsoft. 27 July 2007.
- Giannandrea, J. (4 September 2001). "Microsoft breaks Web Plugins in Windows XP". meer.net. Archived from the original on 16 October 2007.
- "Description of Internet Explorer Support for Netscape-Style Plug-ins". Support (3.4 ed.). Microsoft. 31 January 2007.
- "Microsoft Security Bulletin MS03-015 – Critical". Security TechCenter. Microsoft. 23 April 2003.
- "Description of ActiveX Technologies". Support. Microsoft. 19 January 2007.
- "ppapi". Google Code. Google.
- "Getting Started: Background and Basics – The Chromium Projects". chromium.org.
- "Concepts - ppapi - Important concepts for working with PPAPI. - Pepper Plugin API – Google Project Hosting". google.com.
- "Google heats up native code for Chrome OS". theregister.co.uk.
- "Opera Developer 24: Pepper Flash is coming to Opera". Opera Desktop.
- "NPAPI:Pepper". mozilla.org.
- "Adobe and Google Partnering for Flash Player on Linux". adobe.com.
- Plugin development documentation on Mozilla Developer Center, including the NPAPI API
- An ActiveX control that hosts plugins – 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 two, Part three, Part four)
- Opera 15+ extensions documentation