Akhil
Akhil

Reputation: 1083

Return an integer/String from NPAPI plugin to JavaScript(Not using FireBreath)

Could anyone please explain with a sample...?
How can I return an integer/String from NPAPI plugin(Not using FireBreath) to JavaScript? I searched a lot ..but can't get a relevant answer.

Upvotes: 1

Views: 672

Answers (2)

Akhil
Akhil

Reputation: 1083

Found a solution.
Returning a string from NPAPI plugin

char* npOutString = (char *)pNetscapefn->memalloc(strlen(StringVariable) + 1);

if (!npOutString) return false; strcpy(npOutString, StringVariable); STRINGZ_TO_NPVARIANT(npOutString, *result);

Upvotes: 2

hapyfishrmn
hapyfishrmn

Reputation: 177

You need to make a Scriptable class of NPObject: Simple class definition and implementation

You can this post use in Firefox/Chrome browser. Its very similar to your question and has code for the invoke and the JavaScript/html. here.

If you have not read through at least part 1-3 of taxillian's blog on plugins, I would say it is a must read. Read carefully a lot of info I have missed by skimming by when reading.

Part 1

Part 2

Part 3

Upvotes: 2

Related Questions