Pergunta

I have developed a scriptable NPAPI plugin. When I try to load a single instance in Chrome/Firefox, I have no issues communicating back to the webpage's (Webpage A) and its javascript. But once I open a new page (Webpage B) with the embeded plugin it wants to communicate Webpage A and not Webpage B. How do I differentiate between the two?

Could this be because the Entrypoints have alreasy been set and need reset to the correct instance?

Thanks

Foi útil?

Solução

Entrypoints won't affect what you're talking about; most likely you're not tracking the NPP instances correctly or you have something else that is global that shouldn't be.

The basic entrypoints are not instance specific; if you look at the NPP_* functions, all the ones that are specific to an instance take a "NPP" as the first parameter; generally you'll keep a pointer to some sort of data structure in the pdata field of the NPP and that's what you should use to differentiate between the different instances. If you're not doing this correctly or if somewhere else you're storing a global or static variable that should be instance specific these could all cause the issue you describe.

You may want to consider using FireBreath or Nixysa; the first abstracts most of the pain of NPAPI away and gives you IE support as well, and the second can generate the skeleton w/ API for you so that you fill in the other code and you start with something that already works.

Further information about how the NPP structure works and how you differentiate between different instances can be found at http://npapi.com/tutorial2

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top