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


Block of instance information saved after the plug-in instance is deleted; can be returned to the plug-in to restore the data in future instances of the plug-in.


typedef struct _NPSavedData
    int32  len;
    void*  buf;
} NPSavedData;


The data structure has the following fields:

Length in bytes of the buffer pointed to by buf; set by the plug-in.
Pointer to a memory buffer allocated by the plug-in with NPN_MemAlloc(). Can be any reasonable size; its contents are private to the plug-in and are not modified by the browser.


The NPSavedData object contains a block of per-instance information that the browser saves after the instance is deleted. This information can be returned to another instance of the same plug-in if the user returns to the web page that contains it.

You can use the plug-in's NPP_Destroy() function to allocate an NPSavedData object using the NPN_MemAlloc() function, fill in the fields, and return it to the browser as an output parameter. See Instance Destruction for a code example that shows how to use NPSavedData.

If the user revisits a web page that contains a plug-in, the browser returns the NPSavedData to the new instance of the plug-in in a call to NPP_New(). After this, the plug-in is responsible for keeping or deleting the objects as necessary.

See also

Document Tags and Contributors

 Contributors to this page: teoli, Sheppy, jgriffin, Pmash
 Last updated by: teoli,