NPN_PostURLNotify

Summary

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

Syntax

#include <npapi.h>

NPError NPN_PostURLNotify(NPP         instance,
                          const char* url,
                          const char* target,
                          uint32      len,
                          const char* buf,
                          NPBool      file,
                          void*       notifyData);

Parameters

The function has the following parameters:

instance
Current plug-in instance, specified by the plug-in.
url
URL of the POST request, specified by the plug-in.
target
Target window, specified by the plug-in. For values, see NPN_GetURL.
len
Length of the buffer buf.
buf
Path to local temporary file or data buffer that contains the data to post.
file
Whether to post a file. Values:
  • true: Post the local file whose path is specified in buf, then delete the file.
  • false: Post the raw data in buf.
notifydata
Plug-in-private value for associating the request with the subsequent NPP_URLNotify call, which returns this value (see Description below).

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_PostURLNotify functions identically to NPN_PostURL, with these exceptions:

  • NPN_PostURLNotify supports specifying headers when posting a memory buffer.
  • NPN_PostURLNotify calls NPP_URLNotify upon successful or unsuccessful completion of the request. For more information, see NPN_PostURL.

NPN_PostURLNotify is typically asynchronous: it returns immediately and only later handles the request and calls NPP_URLNotify.

If this function is called with a target parameter value of _self or a parent to _self, this function should return an INVALID_PARAM NPError. This is the only way to notify the plug-in once it is deleted. See NPN_GetURL for information about this parameter.

See also