C++ 适用于 Google Chrome 的简单 hello world NPAPI 插件?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2652034/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 00:13:52  来源:igfitidea点击:

A simple hello world NPAPI plugin for Google Chrome?

c++google-chromenpapibrowser-plugin

提问by Kristina Brooks

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++.

我正在尝试制作一个 chrome 插件,但 Chrome API 没有给我足够的力量。我想使用 NPAPI,但我不知道如何使用它,但我确实有 Visual C++ 的经验。

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

有人可以在 C++ 应用程序中向我展示一个“Hello world”,这样我就可以开始了吗?

回答by Georg Fritzsche

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.

注意:Firefox 和 Chrome很快会将大多数插件默认为点击播放,Chrome 计划完全淘汰 NPAPI。此时不鼓励为新项目使用 NPAPI。

NPAPI plugins shouldn't be browser specific (at least as far as possible). Seamonkeys npruntimesamplecan be considered a basic Hello Worldfor NPAPI. If you care about up-to-date Mac support, you need to take a look at WebKitsor Apples samples.

NPAPI 插件不应该是特定于浏览器的(至少尽可能)。Seamonkeys npruntime示例可以被视为NPAPI的基本Hello World。如果您关心最新的 Mac 支持,您需要查看WebKits或 Apples 示例。

Reading material to get you started:

阅读材料以帮助您入门:

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

还有FireBreath项目:它是一个旨在降低浏览器插件开发入门门槛的框架,并且已经处理了最常见的任务和问题。

回答by Nathan Osman

Here is a simple cross platform example: npsimple

这是一个简单的跨平台示例:npsimple