views:

216

answers:

2

Hi,

I have tried out the NPRuntime sample provided with the Gecko SDK 1.9.1 with the help of this link.

It works perfectly fine with Firefox 3.6.

Following the above steps I created a new scripting plugin (npmyplugin.dll). I am currently placing npmyplugin.dll in a folder other than Firefox/plugins. I am registering the associated mime-type and plugin path in the registry. The plugin gets loaded properly. But now the browser is not calling NPP_GetValue.

I was suspecting that it must be because I am placing the plugin in a directory other than Firefox/plugins. Hence I did the same with npruntime.dll (the sample which comes with Gecko sdk). Suprisingly npruntime.dll scripting was working. Please guide me whether I missing anything important while creating the new plugin.

A: 

Sorry for replying so late. I somehow solved the problem. I was embedding the plugin using tag

then i wrote a small javascript code

var MyWorkingPlugin = document.getElementById('MyPlugin');

It seems that after executing the above javascript NPP_GetValue was called. Currently I have no convincing reason why it happened but it worked and I am happy for the moment. If anyone can explain the above behaviour please let us know.

A: 

NPP_GetValue doesn't get called to get the NPObject until the first time you access it with javascript in many cases. When you do a getElementById, it will make the call.

Likely other calls to GetValue are being made, but you aren't seeing them because you aren't handling them. However, that's still not guaranteed.

Taxilian
As I think on it, I think I have also seen this issue happen when using the <embed> tag on some browsers. Not sure why. Just be safe and use <object>; dunno why, but it consistently works better than <embed>
Taxilian