NPN_GetValue

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

Summary

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

Syntax

#include <npapi.h>
NPError NPN_GetValue(NPP         instance,
                     NPNVariable variable,
                     void        *value);

Parameters

This function has the following parameters:

instance
Pointer to the current plug-in instance.
variable
Information the call gets. Values for NPNVariable:
  • NPNVxDisplay =1: Unix only: Returns the current Display
  • NPNVxtAppContext: Unix only: Returns the application's XtAppContext
  • NPNVnetscapeWindow: MS Windows and Unix/X11 only:
    • MS Windows: Gets the native window on which plug-in drawing occurs; returns HWND
    • Unix/X11: Gets the browser toplevel window in which the plug-in is displayed; returns Window
  • NPNVjavascriptEnabledBool: Tells whether JavaScript is enabled; true=JavaScript enabled, false=not enabled
  • NPNVasdEnabledBool: Tells whether SmartUpdate (former name: ASD) is enabled; true=SmartUpdate enabled, false=not enabled
  • NPNVisOfflineBool: Tells whether offline mode is enabled; true=offline mode enabled, false=not enabled
  • NPNVToolkit:
  • NPNVSupportsXEmbedBool:
  • NPNVWindowNPObject: Returns the NPObject * pointer for the DOM window object; see Getting the page URL in NPAPI plugin  for a rough example
  • NPNVPluginElementNPObject:
  • NPNVSupportsWindowless: Tells whether the browser supports windowless plugins. The value parameter should point to a NPBool, which will be set appropriately if the function returns NPERR_NO_ERROR.
  • NPNVprivateModeBool: Indicates whether or not the browser is currently in private browsing mode. The value parameter should point to an NPBool, which will be set appropriately if the function returns NPERR_NO_ERROR
  • NPNVdocumentOrigin: The value for this variable is the Unicode serialization of the origin converted to NFKC-encoded (normalized) UTF-8. Memory for this string must be freed by the plugin via NPN_MemFree(). For more information, see the document origin specification
  • NPNVpluginDrawingModel: (Mac only)
  • NPNVsupportsQuickDrawBool : (Mac only)
  • NPNVsupportsCoreGraphicsBool : (Mac only)
value
Function returns the name of the plug-in in the value parameter.

Gecko 1.9.2 note
Starting with Gecko 1.9.2 (Firefox 3.6), the variables NPNVserviceManager, NPNVDOMElement, and NPNVDomWindow are no longer supported.

Returns

  • If successful, the function returns NPERR_NO_ERROR.
  • If unsuccessful, the plug-in is not loaded and the function returns an error code. For possible values, see Error Codes.

Description

NPN_GetValue returns the browser information set with NPN_SetValue. The queried information is returned in the value parameter.

Unix

The platform-specific values for this parameter are NPNVxDisplay (the current Display), NPNVxtAppContext (the browser's XtAppContext), and NPNVnetscapeWindow (the browser toplevel window in which the plugin is displayed).

You can use NPNVnetscapeWindow to obtain the appropriate Window for the WM_TRANSIENT_FOR property of a dialog box created from the plug-in.

Microsoft Windows

You can use this method to help create a menu or dialog box for a windowless plug-in. In order to bring up popup menus and modal dialogs, a plug-in needs a parent window. A windowless plug-in does not receive its own native window. Instead, it draws directly into the drawable given to it. Use the NPNVnetscapeWindow value to get the native window on which plug-in drawing occurs.

The method returns a value of type HWND. In many cases, a plug-in may still have to create its own window (a transparent child window of the browser window) to act as the owner window for popup menus and modal dialogs. This transparent child window can have its own WindowProc within which the plug-in can deal with WM_COMMAND messages sent to it a result of tracking the popup menu or modal dialog.

See also

NPN_SetValue, NPP_GetValue

Document Tags and Contributors

 Contributors to this page: teoli, kscarfone, Sheppy, Waldo, fracting, Jonathan_Watt, Dougma, Karlt, Pmash
 Last updated by: teoli,