A Simple Hello World Npapi Plugin for Google Chrome

A simple hello world NPAPI plugin for Google Chrome?

Note: Both Firefox and Chrome will default most plugins to click-to-play soon, with Chrome planning to phase out NPAPI entirely. NPAPI for new projects is discouraged at this point.

NPAPI plugins shouldn't be browser specific (at least as far as possible). Seamonkeys npruntime sample can be considered a basic Hello World for NPAPI. If you care about up-to-date Mac support, you need to take a look at WebKits or Apples samples.

Reading material to get you started:

  • Building a FireFox plugin - 3 part introduction to NPAPI
  • Gecko Plugin API reference - NPAPI documentation at MDC
  • Mac specific info on MDC

There is also the FireBreath project: It is a framework aiming at lowering the entry barrier to browser plugin development and already takes care of most common tasks and issues.

Unable to load npapi helloworld plugin as extension in chrome browser

When you added it to the CRX did you mark it public? If you don't it won't be visible outside of the extension.

See the relevant docs

Here is another relevant question: Google Chrome Extensions and NPAPI

Simple example for NPAPI plugin

The firebreath NPAPI framework seems to have decent documentation: http://www.firebreath.org/display/documentation/FireBreath+Home

Basic Plugin (NPAPI / npruntime) Hello world

If you're trying to run this on windows then it won't work; you have the wrong entrypoints for windows. The ones you have listed are the entrypoints for linux. See https://github.com/firebreath/FireBreath/blob/master/src/PluginAuto/Win/np_winmain.cpp for FireBreath's windows entrypoints file; also explained in http://npapi.com/tutorial

Edit

Hypothetically there could be lots of other things; without seeing your whole project it's hard to speculate. It's showing up in about:plugins, so your strings resources are in place. Are you exporting the symbols correctly with your .def file? Does DllMain get called? (don't use a messagebox there, just log something or set a breakpoint)

Again, FireBreath is (aside from being a much easier way to create a NPAPI plugin) an example of creating a fully functioning npapi plugin; you may learn a lot from looking at it. If none of that works I couldn't begin to speculate without seeing your whole project; maybe as a github project or something?

Any example of writing an NPAPI plugin in Linux?

you could also use the open source FireBreath plugin framework; they are nearing a 1.0 release for windows only, but it would not be hard to port it to linux; mac os shouldn't be bad either, but it will take a little work to get CMake to generate the correct bundle type =]

Yes, I am one of the primary maintainers, so I'm a bit biased. You can also find some good general information on how NPAPI works on my blog, starting here:
http://colonelpanic.net/2009/03/building-a-firefox-plugin-part-one/

Simple working example using plugin writen in Qt and make it work with NPAPI

There's a nice framework called Firebreath for writing cross-platform browser plugins in C++. It comes with plenty of documentation and example projects, so it's easy to get started. As a plus, in addition to NPAPI hosts you pretty much get free support for ActiveX browsers (Internet Explorer) too.

http://www.firebreath.org



Related Topics



Leave a reply



Submit