Netscape DevEdge

Skip to: [content] [navigation]




Returns version information for the Plug-in API.


#include <npapi.h>
void NPN_Version(int*  plugin_major,
                 int*  plugin_minor,
                 int*  netscape_major,
                 int*  netscape_minor);


The function has the following parameters:

Pointer to a plug-in's major version number; changes with major code release number.
Pointer to a plug-in's minor version number; changes with point release number.

Pointer to the browser's major version; changes with major code release number.

Pointer to the browser's version; changes with point release number.


The values of the major and minor version numbers of the Plug-in API are determined when the plug-in and the browser are compiled. For example, Plug-in API version 4.03 has a major version number of 4 and a point release number of 3. This function gets the values from the plug-in rather than from the browser.

A plug-in can use this function to check that the version of the Plug-in API it is using is compatible with the version in use by the browser. This could be part of the initialization process. For more information and an example, see "Getting the Current Version."

You can use NPN_Version to inquire on version constants (NPVERS constants), which represent particular Communicator features. Once the plug-in obtains a version number, it can inquire on a version constant to find out if the feature it represents exists in this version. For example, the plug-in could inquire on the constant NPVERS_HAS_WINDOWLESS to see if it is running in a version of Communicator that supports windowless functionality. For more information and an example, see "Finding Out if a Feature Exists." For a listing of version constants defined in the Plug-in API, see "Version Feature Constants."

NOTE: Platform-specific code in the Plug-in API files npwin.cpp, npmac.cpp, or npunix.c checks version numbers automatically. A plug-in whose major version is less than the major version of the browser is not loaded. §

See Also

NPN_UserAgent, NP_Initialize

Netscape Communications