谷歌浏览器扩展和 NPAPI [英] Google Chrome Extensions and NPAPI

查看:107
本文介绍了谷歌浏览器扩展和 NPAPI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要编写一些 Google Chrome 扩展程序.问题是 Chrome JavaScript API 没有给我足够的能力 - 我需要使用本机代码.我考虑编写一个 NPAPI 插件,该插件将为扩展提供一些自定义 JS API.

I need to write some Google Chrome extension. The problem is that Chrome JavaScript APIs don't give me enough power - I need to use native code. I thought about writing a NPAPI plug-in that will provide the extension some custom JS APIs.

是否可以将扩展程序和自定义 NPAPI 插件打包在 .crx 中,然后将其上传到 Chrome 扩展商店?

Is it possible to package the extension, plus the custom NPAPI plugin inside a .crx, and then upload it to the Chrome Extensions Store?

这种方法的另一个问题是,NPAPI插件会有很多版本:Linux、Windows、OS X、x86、x86-64等.是否可以将所有这些都打包在crx中并使用最好的版本?

Another issue with this method is that the NPAPI plugin will have many versions: Linux, Windows, OS X, x86, x86-64, etc. Is it possible to package all these in the crx and use the best version?

谢谢.

阅读这个后a>,我意识到不可能在一个crx中优雅地解决多平台问题.但是 - 是否可以将每个平台的不同 crx-s 上传到 Chrome 扩展程序商店?

After reading this, I realized that it's not possible to elegantly solve the multi-platform issue in one crx. But - is it possible to upload different crx-s for each platform to the Chrome extension store?

推荐答案

如果你想在一个 CRX 中实现多平台,你应该把它们按这个顺序放在清单中:

If you want multi platform in one CRX, you should put them in this order within the manifest:

"plugins": [
   { "path": "plugin-windows.dll" },
   { "path": "plugin-linux.so" },
   { "path": "plugin-mac.plugin" }
]

请记住,将您的 NPAPI 扩展程序上传到商店仅适用于 Google Chrome 扩展程序.对于 Google Chrome OS(使用 Google Chrome),您将无法使用 NPAPI.

Remember uploading your NPAPI extension to the store will only work in Google Chrome Extensions. In the case of Google Chrome OS (which uses Google Chrome), you will not be able to use NPAPI.

但是您应该研究 PPAPI,这将是为扩展进行插件开发的推荐方式:

But you should look into PPAPI which will be the recommended way doing plugin development for extension:

http://src.chromium.org/viewvc/chrome/trunk/src/ppapi/

与此同时,扩展中的 NPAPI,您需要遵循本指南(效果很好):

In the meantime NPAPI in extensions, you need to follow this guide (which works great):

http://code.google.com/chrome/extensions/npapi.html

请记住,您真的需要在您的扩展程序中使用 NPAPI 吗?如果您能找到 HTML5 解决方法,那就更好了.

Just remember, do you really need to use NPAPI in your extension? If you could find a HTML5 workaround, it would be better.

这篇关于谷歌浏览器扩展和 NPAPI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆