NPAPI:HTTPRedirectHandling: Difference between revisions

Jump to navigation Jump to search
Line 15: Line 15:


= Specification =
= Specification =
== Notification ==


The following function can be implemented by plugins to allow for URL redirect handling:
The following function can be implemented by plugins to allow for URL redirect handling:
Line 31: Line 33:


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.
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.
== Response ==


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 41: Line 45:


This function must be available if the browser has called 'NPP_URLRedirectNotify' on the plugin.
This function must be available if the browser has called 'NPP_URLRedirectNotify' on the plugin.
In 'NPN_URLRedirectResponse', the applicable query getting the redirect is identified by the combination of 'instance' and 'notifyData'.  If there are extant calls to NPN_GetURLNotify() or NPN_PostURLNotify() with particular values for 'instance' and 'notifyData' that have not finished, any subsequent calls to those with the same values of NPP and notifyData will result in undefined behavior.


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 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.
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.
== Threading ==
With respect to threading, this specification conforms to standard NPAPI thread rules. Unless otherwise explicitly noted, all NPAPI functions must be called on the main thread.
== Notification ==


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