Browser-side plug-in API

This article needs a technical review. How you can help.

This feature has been removed from the Web standards. Though some browsers may still support it, it is in the process of being dropped. Do not use it in old or new projects. Pages or Web apps using it may break at any time.

This chapter describes methods in the plug-in API that are provided by the browser; these allow call back to the browser to request information, tell the browser to repaint part of the window, and so forth. The names of all of these methods begin with NPN_ to indicate that they are implemented by the browser and called by the plug-in. For an overview of how these two sides of the plug-in API interact, see the How Plug-ins Work and Overview of Plug-in Structure sections in the introduction.

Warning: You must only call these from the main thread; calling them from other threads is not supported and may have unpredictable results.

Closes and deletes a stream.

Asks the plugin host to immediately (synchronously) repaint invalid areas.

The function is called by plugins to get HTTP authentication information from the browser.

Asks the browser to create a stream for the specified URL.

Requests creation of a new stream with the contents of the specified URL; gets notification of the result.

Allows the plug-in to query the browser for information.

Provides information to a plugin which is associated with a given URL, for example the cookies or preferred proxy.

Invalidates the specified portion of the plugin's drawing area, adding it to the region that needs to be redrawn when the plugin next repaints its contents.

Invalidates the specified drawing region prior to repainting or refreshing a windowless plug-in.

Allocates memory from the browser's memory space.

Requests that the browser free a specified amount of memory.

Deallocates a block of allocated memory.

Requests the creation of a new data stream produced by the plug-in and consumed by the browser.

Thread safe way to request that the browser calls a plug-in function on the browser or plugin thread (the thread on which the plug-in was initiated).

Posts data to a URL.

Posts data to a URL, and receives notification of the result.

Reloads all of the installed plugins.

Requests a range of bytes from a seekable stream. This initiates a read operation; the actual data is received through subsequent calls to NPP_WriteReady() and NPP_Write().

Implemented by browsers. This call is used to inform the browser of variable information controlled by the plugin.

Allows a plugin to change the stored information associated with a URL, in particular its cookies. (While the API theoretically allows the preferred proxy for a given URL to be changed, doing so does not have much meaning given how proxies are configured, and is not supported.)

Lets a plug-in display a message on the browser's status line.

Returns the browser's user agent field. This can be used to handle variations in different browsers (or versions thereof) when implementing your plug-in.

Lets plugins obtain version information, both of the plug-in API and of the browser itself.

Pushes data into a stream produced by the plug-in and consumed by the browser.


Document Tags and Contributors

 Contributors to this page: kscarfone, nanz, Sheppy
 Last updated by: kscarfone,