我想使用 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/