16

I am trying to make a chrome plugin but Chrome API doesn't give me enough power. I want to use NPAPI but I have no idea how to use it but I do have experience in Visual C++.

Can someone show me a 'Hello world' in C++ application so I can get started?

Georg Fritzsche
  • 97,545
  • 26
  • 194
  • 236
Kristina
  • 15,859
  • 29
  • 111
  • 181

2 Answers2

24

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:

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.

Georg Fritzsche
  • 97,545
  • 26
  • 194
  • 236
  • I also recommend reading a book "Programming Netscape Plug-Ins" by Zan Oliphant http://www.podgoretsky.pri.ee/ftp/Docs/Internet/Netscape%20Plug-Ins/ – Vanuan Oct 04 '10 at 22:39
  • Keep in mind that as of 09/23/13, Chrome is phasing out support for NPAPI based solutions. http://blog.chromium.org/2013/09/saying-goodbye-to-our-old-friend-npapi.html – Please treat your mods well. Sep 23 '13 at 18:43
  • ... and Firefox will make all plugins except Flash click-to-play a month before Chrome. – Georg Fritzsche Sep 23 '13 at 19:39
  • 1
    what is replacing npapi – Techsin Nov 15 '13 at 19:59
  • @Techsin: Ideally Web APIs - many capabilities were added to the web platform recently, especially motivated by the different situation on mobile. – Georg Fritzsche Nov 15 '13 at 20:42
  • This is misleading and false: NPAPI is not being discouraged to be used – only Google Chrome dropped its support. Firefox doesn't have any plans to remove its support at all, all they did is making the plugins click-to-play. NPAPI is still the right way to write plugins for Firefox in C or C++. Chrome moved to its own API called NaCl – and that's the new way to write plugins in C or C++ for Chrome. IMHO what Chrome did is downright stupid. – pampeho Aug 25 '15 at 16:23
  • @Zupoman: This is not misleading nor false. NPAPI is on its way out for Firefox too, just slower. We already default most plugins to click-to-play, long term NPAPI is at question. The WIP 64bit builds already cut support for most plugins. – Georg Fritzsche Aug 26 '15 at 12:30
  • @GeorgFritzsche this: https://support.mozilla.org/pl/questions/972191 and this: https://support.mozilla.org/pl/questions/974299 clearly say that they aren't going to drop NPAPI support. Also as far as I know there is no real alternative to NPAPI in Firefox for plugins written in C/C++. – pampeho Aug 26 '15 at 15:11
7

Here is a simple cross platform example: npsimple

Brian
  • 25,523
  • 18
  • 82
  • 173
Nathan Osman
  • 71,149
  • 71
  • 256
  • 361
  • Visual Studio solution release is for Smartphone? Also, getting the dependencies (npapi headers) is required, they are not inside the repository. Usually hunting the compilation dependencies in Windows sucks the most. – Ciantic Jun 19 '10 at 16:00
  • 3
    Turns out the headers can be found from rather obscure google-code SVN http://code.google.com/p/npapi-headers/ – Ciantic Jun 19 '10 at 17:05
  • 1
    It's the [npapi-sdk](http://code.google.com/p/npapi-sdk/) project now. [This pull request](https://github.com/mikma/npsimple/pull/1) seems to update npsimple to it. – Georg Fritzsche Apr 15 '13 at 16:25