クロムの拡張機能を作成しています。C で記述されたコードを呼び出すために NPAPI を使用しています。「.so」ファイル (NPAPI プラグインの出力) をリンクhttp://code.google.com/に従ってクロムにリンクします。クロム/拡張機能/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?