NPAPI:HTTPRedirectHandling: Difference between revisions

Jump to navigation Jump to search
Line 23: Line 23:
* instance: The plug-in instance that made the request.
* instance: The plug-in instance that made the request.
* url: The new target url for the redirect.
* url: The new target url for the redirect.
* status: The status code returned from the server (will be 3xx).
* status: The HTTP status code returned from the server (will be 3xx).
* notifyData: The plugin's private request data.
* notifyData: The plugin's private request data.


Line 30: Line 30:
   NPVERS_HAS_URL_REDIRECT_HANDLER = 26
   NPVERS_HAS_URL_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 up to the browser. The recommended default behavior is to allow all same-origin redirects and disallow all cross-origin redirects.
The slot for this handler in the plugin function structure can be 'NULL'. If this handler is not provided then redirect behavior is up to the browser. The recommended default behavior is to allow all same-origin redirects and disallow all cross-origin redirects.


Plugins must respond to URL redirect requests by calling the following function in the browser's function table:
Plugins must respond to URL redirect requests by calling the following function in the browser's function table:
Line 44: Line 44:
Network requests may time out if a response is not received in a reasonable amount of time. 'NPN_URLRedirectResponse' can be called during the call to 'NPP_URLRedirectNotify'.
Network requests may time out if a response is not received in a reasonable amount of time. 'NPN_URLRedirectResponse' can be called during the call to 'NPP_URLRedirectNotify'.


There may be further redirect notifications when a redirect is allowed. When a redirect is disallowed or an asynchronous redirect response is not received within a reasonable amount of time the browser will subsequently issue an 'NPP_URLNotify' call with reason 'NPRES_USER_BREAK' and the last allowed or original url.
There may be further redirect notifications when a redirect is allowed. When a redirect is disallowed or a response is not received within a reasonable amount of time the browser will subsequently issue an 'NPP_URLNotify' call with reason 'NPRES_USER_BREAK' and the last allowed or original url.


Plugins can query the browser for support for this specification by examining the browser's function table. If the version number is equal to or higher than 'NPVERS_HAS_URL_REDIRECT_HANDLER' and the slot for 'NPN_URLRedirectResponse' is non-NULL then the browser will call 'NPP_URLRedirectNotify' when appropriate.
Plugins can query the browser for support for this specification by examining the browser's function table. If the version number is equal to or higher than 'NPVERS_HAS_URL_REDIRECT_HANDLER' and the slot for 'NPN_URLRedirectResponse' is non-NULL then the browser will call 'NPP_URLRedirectNotify' when appropriate.
Confirmed users, Bureaucrats and Sysops emeriti
1,680

edits

Navigation menu