c++ - 在 C++ 中使用 NPAPI 开发 Chrome 扩展

标签 c++ google-chrome plugins google-chrome-extension

我想使用 NPAPI 在 C++ 中开发一个简单的 Chrome 扩展程序,它将当前页面的 HTML 内容转储到一个文件中。我在开发插件/扩展方面没有太多专业知识。我该如何开始?

最佳答案

1 - 创建扩展... http://code.google.com/chrome/extensions/getstarted.html

2 - 创建一个 NPAPI 插件... http://colonelpanic.net/2009/03/building-a-firefox-plugin-part-one/

3 - 在您的扩展 list 中添加插件...

"plugins": [
    { "path": "your_npapi_plugin.dll" }    
  ],

4 - 在您的扩展背景页面上创建插件

<script>
var plugin = document.getElementById("MyNPAPIPluginId");
...
</script>

5 - 创建一个 javascript,您将用作在每个页面上注入(inject)的内容脚本。 在该脚本上与您的 npapi 可编写脚本的对象通信并执行您想要执行的工作。


How do I get the value of MyNPAPIPluginId? All I have is the name of the DLL?

在添加插件标签时,在后台页面上放置 id

<embed type="application/my-plugin-mimetype" id="MyNPAPIPluginId">

在 Windows 上,您在 DLL 的资源文件中添加 MIMEType,添加一个条目:

VALUE "MIMEType", "application/my-plugin-mimetype"

关于c++ - 在 C++ 中使用 NPAPI 开发 Chrome 扩展,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9392536/

相关文章:

C++ HTTP Winsock : "Banned URL" at school, 即使是允许的网站

c++ - 使用CMake的Qt moc错误

c++ - 删除指针数组——我做对了吗?

javascript - 相当于 FF 和 IE 中的 'window.location.ancestorOrigins'

html - 在 Chrome 中正确显示,但在 Internet explorer 11 中不正确

javascript - Chrome 扩展程序在所有选项卡中设置切换开关状态

c++ - 为什么越界指针算术未定义行为?

java - Bukkit - 使用自定义配方添加自定义项目

android - 默认安卓浏览器的浏览器插件

java - 如何在 Java 上创建数据流图