了解浏览器插件:创建、部署和使用
假设我想创建一个浏览器插件,每当某人单击我的网页上的按钮时,该插件就会打开他们的软盘驱动器。 (你还记得那个老笑话吗? - 别担心,我真的不想这样做。)
- 创建可在大多数浏览器和大多数操作系统上运行的浏览器插件需要执行哪些步骤?
- 如何部署插件?例如,如何才能使插件可以轻松下载和安装?我需要担心数字证书吗?
- 安装插件后如何检查和使用该插件? javascript 是否可以以 API 的形式使用它?
Let's say I wanted to create a browser plug-in that would open someone's floppy drive for them whenever they click a button on my web page. (You remember that old gag? - Don't worry, I don't really want to do that.)
- What are the steps necessary to create a browser plug-in that will work on most browsers and most operating systems?
- How do I deploy the plug-in? For instance, how do I make it so that the plug-in can be easily downloaded and installed? Do I have to worry about digital certificates?
- How do I check for and use the pluggin once it's installed? Is it available to javascript in the form of an API?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
看一下名为 FireBreath 的项目: http://www.firebreath.org/display/ Documentation/FireBreath+Home
Firebreath 抽象了浏览器插件框架和平台问题之间的许多差异,因此您可以轻松地为插件编写一次代码,然后针对不同平台重新编译它。
我发现它非常适合将现有的 C/C++ 库 API 暴露给 Javascript,这样我就可以编写使用 C++ 库中的功能的动态页面,而这些功能在其他情况下不可用。
Take a look at a project called FireBreath: http://www.firebreath.org/display/documentation/FireBreath+Home
Firebreath abstracts many of the differences between the browser plugin frameworks and platform issues so you can easily write the code for a plugin once and just re-compile it for different platforms.
I have found it good for exposing existing C/C++ library API's to Javascript so I can write dynamic pages that use functionality from the C++ library which were otherwsie not available.
大多数现代浏览器都有自己的插件框架供开发人员使用。例如,Firefox 插件无法在 Chrome 或 IE 中运行。 Firefox 和 Chrome 都使用了 javascript 和 css,但它们的结构有根本的不同。
就部署而言,Mozilla 和 Google 为其各自的插件提供托管。我确实知道 Firefox 扩展基本上是扩展名已更改的 zip 文件。
编辑...
我以为您指的是浏览器扩展,所以如果情况并非如此,请忽略我的回答。
Most modern browsers have their own plugin frameworks for developers to utilize. So, for example, a Firefox plugin will not work in chrome or IE. Firefox and chrome do both utilize javascript and css but they are fundamentally different in their structure.
As far as deployment, Mozilla and Google provide hosting for their respective plugins. I do know that firefox extensions are basically zip files with the extension changed.
EDIT...
I had assumed you meant browser extensions so disregard my answer if that is not the case.
最简单的跨浏览器解决方案是使用 Java Applets 或 Flash(我不确定你如何在 Flash 中做到这一点)。
对于小程序,您需要对小程序进行签名,并创建用于访问磁盘的安全策略文件。当小程序在浏览器中加载时,它会请求客户端用户的许可,他/她需要单击“允许”以授予小程序访问磁盘的权限。这将允许您访问系统中的任何磁盘。
The easiest cross-browser solution is use Java Applets or maybe Flash (I am not sure how you do it in Flash).
With applets, you would need to sign the applet and also create a security policy file for accessing the disk. When the applet loads in the browser it would ask permission from the client user, he/she needs to click Allow to give permission for the applet to access the disk. This would allow you to access any disk in the system.