NPN_Version

« Gecko Plugin API Reference « Browser Side Plug-in API

Summary

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

Syntax

#include <npapi.h>

void NPN_Version(int*  plugin_major,
                 int*  plugin_minor,
                 int*  netscape_major,
                 int*  netscape_minor);

Parameters

The function has the following parameters:

plugin_major
Pointer to a plug-in's major version number; changes with major code release number.
plugin_minor
Pointer to a plug-in's minor version number; changes with point release number.
netscape_major
Pointer to the browser's major version; changes with major code release number.
netscape_minor
Pointer to the browser's version; changes with point release number.

Description

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 browser 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 browser 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