I am trying to send some data as a stream from plug in to javascript. I am using NPN_NewStream for sending the stream from plugin to the browser. I have tried the example mentioned in http://www.terraluna.org/dgp/cvsweb/PluginSDK/Documentation/pi3.htm#npnnewstream successfully. This creates a new stream of HTML text displayed by Netscape in a new window. Now I want to know how I can send some data in the form of xml in a similar way from the plugin to the javascript, receive the 开发者_Python百科data in javascript and do some processing in the javascript with the data sent from the plugin.
I dont' know of a way to do this using NPN_NewStream, and the method for sending HTML to a new window reportedly does not work on all browsers.
However, you can just pass it in a function call as a parameter; make a NPVariant with the text you need and call it into javascript. Alternately have javascript call you and return it from a GetProperty or Invoke call.
FireBreath users do things like this all the time. For more info see http://npapi.com/tutorial3
精彩评论