NPN_GetURLNotify

Summary

Requests creation of a new stream with the contents of the specified URL; gets notification of the result.

Syntax

#include <npapi.h>
NPError NPN_GetURLNotify(NPP    instance,
                         const  char* url,
                         const  char* target,
                         void*   notifyData);

Parameters

The function has the following parameters:

instance
Pointer to the current plug-in instance.
url
Pointer to the URL of the request. Can be of any type, such as HTTP, FTP, news, or mailto.
target
Name of the target window or frame, or one of several special target names. For values, see NPN_GetURL().
notifyData
Plug-in-private value for associating the request with the subsequent NPP_URLNotify() call, which passes 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_GetURLNotify() works just like NPN_GetURL(), with one exception: NPN_GetURLNotify() notifies the plug-in instance upon successful or unsuccessful completion of the request by calling the plug-in's NPP_URLNotify() function and passing it the notifyData value.

NPN_GetURLNotify() typically handles the URL request asynchronously. It returns immediately and only later handles the request and calls NPP_URLNotify(). This notification is the only way the plug-in can tell whether a request with a null target failed, or that a request with a non-null target completed.

For requests that complete unsuccessfully, the browser calls NPP_URLNotify() as soon as possible. For requests that complete successfully:

If this function is called with a target parameter value of _self or a parent to _self, this function should return NPERR_INVALID_PARAM. This is the only way to notify the plug-in once it is deleted.

Warning: In Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1), NPN_GetURLNotify() does not notify the plug-in if notifyData is NULL. See bug 638367 for details.

See also