views:

400

answers:

2

My experience to write a plugin for FireFox is below zero. Is someone out there who could point me to sample code on how to get this accomplished in C++ with VS2005/8?

What I need to do with JavaScript in the hosting html page is something like this:

var obj = document.getElementById("MyFFPlugin");

var value = obj.CalculateValue;

// Work with calculated value

Thanks!

+3  A: 

The SDK has basic samples on how to write mozzila plugins which can be downloaded here: http://mxr.mozilla.org/seamonkey/source/modules/plugin/tools/sdk/

Here is the official mozilla plugin site http://www.mozilla.org/projects/plugins/

Hope it helps.

RWendi
A: 

I highly recommend using Nixysa http://code.google.com/p/nixysa/, which wraps NPAPI. From the site:

Nixysa is a framework written in Python to automatically generate glue code for NPAPI plugins (plugins for browsers such as Google Chrome or Firefox), letting you easily expose C++ classes to Javascript from a simple IDL representation. Nixysa was originally conceived for the needs of O3D, but is flexible enough to support a wide range of use cases.

Try it

Check out the code following the instructions here and try the sample in examples/complex.

The sample includes a Visual Studio 2005 project.

Charles