NPAPI:HTTPRedirectHandling: Difference between revisions
| Line 29: | Line 29: | ||
NPVERS_HAS_HTTP_REDIRECT_HANDLER = 26 | NPVERS_HAS_HTTP_REDIRECT_HANDLER = 26 | ||
The slot for this handler in the plugin function structure can be NULL. | The slot for this handler in the plugin function structure can be NULL. If this function is not provided then redirect behavior is technically undefined. Most existing browser implementations simply allow all redirects though this is not guaranteed to be the case. | ||
Plugins should return "NPERR_NO_ERR" when the redirect is to be allowed. There may be further redirect notifications when a redirect is allowed. Any return value other than "NPERR_NO_ERR" will disallow the redirect and the browser will subsequently issue an "NPP_URLNotify" call with reason "NPRES_USER_BREAK" and the last redirected url (the same one passed to the NPP_URLNotifyRedirect the last time) | Plugins should return "NPERR_NO_ERR" when the redirect is to be allowed. There may be further redirect notifications when a redirect is allowed. Any return value other than "NPERR_NO_ERR" will disallow the redirect and the browser will subsequently issue an "NPP_URLNotify" call with reason "NPRES_USER_BREAK" and the last redirected url (the same one passed to the NPP_URLNotifyRedirect the last time) | ||
Revision as of 06:31, 10 October 2010
Status
Under consideration.
Contributors
- Last modified: October 8, 2010
- Authors: Rudi Sherry (Adobe), Josh Aas (Mozilla)
- Contributors: Darin Fisher (Google), Dimcho Balev (Adobe), Deneb Meketa (Adobe)
Overview
We need to allow plugins to participate in HTTP redirect handling.
Specification
The following function can be implemented by plugins to allow for HTTP redirect handling:
int32 NPP_URLNotifyRedirect(NPP instance, const char* url,
int32 status, void* notifyData);
- instance: the plug-in instance that made the request
- url: the new redirected url
- status: the status code returned from the server (will be 3xx)
- notifyData: the data passed into NPN_PostURLNotify() or NPN_GetURLNotify()
The browser will look for this handler only if the plugin function structure's version field is set to the following value or higher:
NPVERS_HAS_HTTP_REDIRECT_HANDLER = 26
The slot for this handler in the plugin function structure can be NULL. If this function is not provided then redirect behavior is technically undefined. Most existing browser implementations simply allow all redirects though this is not guaranteed to be the case.
Plugins should return "NPERR_NO_ERR" when the redirect is to be allowed. There may be further redirect notifications when a redirect is allowed. Any return value other than "NPERR_NO_ERR" will disallow the redirect and the browser will subsequently issue an "NPP_URLNotify" call with reason "NPRES_USER_BREAK" and the last redirected url (the same one passed to the NPP_URLNotifyRedirect the last time)
Plugins can query the browser for support for this specification using the following variable:
NPNVsupportsRedirectNotification = 22
If the browser returns "true" for this variable then plugins can depend on the browser calling the HTTP redirect handler when appropriate, if it is provided by the plugin.