从https://github.com/axgle/npapi-chrome-plugin-helloworld下载了NPAPI hello-world插件,并使用chrome开发者模式将其打包为Chrome扩展(crx)。
在chrome浏览器中加载了上述扩展,并尝试在chrome浏览器中打开test.html (与上述插件一起提供)。但它显示“无法加载插件”
下面是test.html的源代码
<doctype html>
<html>
<head>
<script>
window.onload = function(){
test = document.getElementById("pluginObj");
alert(test.sayHello());
}
</script>
</head>
<embed id="pluginObj" type="application/x-helloworld">
<body></body>
</html>根据我的验证,插件正在嵌入(因为在更改测试中它提供了HTML document对象),但无法调用插件的sayHello方法。
然而,当我试图在另一台PC上加载上面的扩展时,它加载正常,并且能够调用插件的sayHello方法。这两个系统具有相同的操作系统(Windows XP + SP3),并且使用相同版本的chrome浏览器(23.0.1271.97 m)
感谢在这方面的任何帮助。
发布于 2013-01-03 11:45:23
当您将其添加到CRX时,是否将其标记为公共的?如果你不这样做,它在扩展之外是不可见的。
请参阅the relevant docs
这是另一个相关的问题:Google Chrome Extensions and NPAPI
https://stackoverflow.com/questions/14127205
复制相似问题