NPN_PostURLNotify

  • Revision slug: NPN_PostURLNotify
  • Revision title: NPN_PostURLNotify
  • Revision id: 386437
  • Created:
  • Creator: ethertank
  • Is current revision? No
  • Comment

Revision Content

{{Np-plugin-api}}

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

Revision Source

<div>{{Np-plugin-api}}</div>

<h2 id="Summary" name="Summary">Summary</h2>
<p>Posts data to a URL, and receives notification of the result.</p>
<h2 id="Syntax" name="Syntax">Syntax</h2>

<pre class="syntaxbox">
#include &lt;npapi.h&gt;
 
NPError NPN_PostURLNotify(NPP         instance,
                          const char* url, 
                          const char* target,
                          uint32      len, 
                          const char* buf,
                          NPBool      file, 
                          void*       notifyData);
</pre>


<h3 id="Parameters" name="Parameters">Parameters</h3>

<p>The function has the following parameters:</p>
<dl>
  <dt>instance</dt>
  <dd>Current plug-in instance, specified by the plug-in.</dd>

  <dt>url</dt>
  <dd>URL of the POST request, specified by the plug-in.</dd>

  <dt>target</dt>
  <dd>Target window, specified by the plug-in. For values, see NPN_GetURL.</dd>

  <dt>len</dt>
  <dd>Length of the buffer buf.</dd>

  <dt>buf</dt>
  <dd>Path to local temporary file or data buffer that contains the data to post.</dd>

  <dt>file</dt>
  <dd>Whether to post a file. Values:
    <ul>
      <li>true: Post the local file whose path is specified in buf, then delete the file.</li>
      <li>false: Post the raw data in buf.</li>
    </ul></dd>

  <dt>notifydata</dt>
  <dd>Plug-in-private value for associating the request with the subsequent <a href="/en-US/docs/NPP_URLNotify">NPP_URLNotify</a> call, which returns this value (<a href="#Description">see Description below</a>).</dd>
</dl>

<h3 id="Returns" name="Returns">Returns</h3>
<ul>
  <li>If successful, the function returns NPERR_NO_ERROR.</li>
  <li>If unsuccessful, the plug-in is not loaded and the function returns an error code. For possible values, see <a href="/en-US/docs/NPAPI/Constants#Error_Codes">Error Codes</a>.</li>
</ul>


<h2 id="Description" name="Description">Description</h2>
<p><code>NPN_PostURLNotify</code> functions identically to <a href="/en-US/docs/NPN_PostURL">NPN_PostURL</a>, with these exceptions:</p>
<ul>
  <li><code>NPN_PostURLNotify</code> supports specifying headers when posting a memory buffer.</li>
  <li><code>NPN_PostURLNotify</code> calls <a href="/en-US/docs/NPP_URLNotify">NPP_URLNotify</a> upon successful or unsuccessful completion of the request. For more information, see <a href="/en-US/docs/NPN_PostURL">NPN_PostURL</a>.</li>
</ul>
<p><code>NPN_PostURLNotify</code> is typically asynchronous: it returns immediately and only later handles the request and calls <a href="/en-US/docs/NPP_URLNotify">NPP_URLNotify</a>.</p>
<p>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 <a href="/en-US/docs/NPN_GetURL">NPN_GetURL</a> for information about this parameter.</p>

<h2 id="See_also" name="See_also">See also</h2>
<ul>
<li><a href="/en-US/docs/NPN_GetURL">NPN_GetURL</a>, <a href="/en-US/docs/NPP_URLNotify">NPP_URLNotify</a>, <a href="/en-US/docs/NPN_PostURL">NPN_PostURL</a></li>
</ul>
Revert to this revision