我正在为 chrome 创建一个扩展。我正在使用 NPAPI 来调用用 C 编写的代码。同时根据链接http://code.google.com/将“.so”文件(这是 NPAPI 插件的输出)链接到 chrome铬/扩展/npapi.html
这是我的 manifest.json
{
"name": "My extension",
...
"plugins": [
{ "path": "../myplugin.so", "public": true },
],
}
这是我的 background.html(chrome 插件的背景页面)
<embed type="application/x-myplugin" id="myplugin">
<script>
var plugin = document.getElementById("myplugin");
var result = plugin.testfunction(); // call a method in your plugin
console.log("my plugin returned: " + result);
</script>
I'm getting an error "Uncaught TypeError: Object #<HTMLObjectElement> has no method 'testfunction'"
How can I fix this?