Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Browser-side plug-in API

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

Deprecated
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.

NPN_DestroyStream
Closes and deletes a stream.

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

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

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

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

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

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

NPN_InvalidateRect
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.

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

NPN_MemAlloc
Allocates memory from the browser's memory space.

NPN_MemFlush
Requests that the browser free a specified amount of memory.

NPN_MemFree
Deallocates a block of allocated memory.

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

NPN_PluginThreadAsyncCall
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).

NPN_PostURL
Posts data to a URL.

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

NPN_ReloadPlugins
Reloads all of the installed plugins.

NPN_RequestRead
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().

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

NPN_SetValueForURL
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.)

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

NPN_UserAgent
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.

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

NPN_Write
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,