chrome / chrome扩展:通过上下文菜单运行可执行文件/脚本 [英] chrome/chromium extension: run a executable/script via the context menu

查看:246
本文介绍了chrome / chrome扩展:通过上下文菜单运行可执行文件/脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个小的chrome扩展供个人使用,我想通过上下文菜单运行一个可执行文件,并传递某些信息作为参数到所述可执行文件。

I'm writing a small chrome extension for personal use and I would like to run an executable via the context menu and pass certain information as arguments to said executable.

最简单和/或最干净的方法如何实现?

What the simplest and/or cleanest way to achieve this? To me it seems that it is impossible due to chrome's sandboxing.

推荐答案

这可以通过通过NPAPI插件


在NPAPI插件中运行的代码具有
当前用户的完全权限,并且不受沙箱或以任何方式被谷歌Chrome浏览器的恶意输入屏蔽。当
处理来自不受信任来源的输入时,例如使用
内容脚本或XMLHttpRequest时,您应该特别小心。

Code running in an NPAPI plugin has the full permissions of the current user and is not sandboxed or shielded from malicious input by Google Chrome in any way. You should be especially cautious when processing input from untrusted sources, such as when working with content scripts or XMLHttpRequest.

但是,我还应该包括他们的警告。

However, I should also include their warning.


警告



NPAPI正在逐步淘汰。考虑使用替代方案。

Warning

NPAPI is being phased out. Consider using alternatives.

NPAPI是一个真正的大锤子,应该只有当没有其他
方法将工作。

NPAPI is a really big hammer that should only be used when no other approach will work.

,通过启动外部

NPAPI的替代品



NPAPI有几种替代方法。如果标准网络
技术还不够,开发人员和管理员可以
使用 NaCl 应用本机讯息API 旧版浏览器支持
从NPAPI过渡。今后,我们的目标是改进
基于标准的网络平台,以覆盖曾经由
NPAPI提供的用例。

There are several alternatives to NPAPI. In cases where standard web technologies are not yet sufficient, developers and administrators can use NaCl, Apps, Native Messaging API, and Legacy Browser Support to transition from NPAPI. Moving forward, our goal is to evolve the standards-based web platform to cover the use cases once served by NPAPI.

,通过 http://blog.chromium。

via http://blog.chromium.org/2013/09/saying-goodbye-to-our-old-friend-npapi.html

另一种方式,

Another way, suggested here, is with Java.


Java applets: http://docs.oracle.com/javase/tutorial/deployment/applet/

实施政策: http:// docs .oracle.com / javase / tutorial / security / userperm / policy.html


  • 使用 sendNativeMessage


    chrome.runtime.sendNativeMessage ,可用于将
    消息发送到本机应用程序和 chrome.runtime.connectNative 其中
    允许更持久的连接。

    There is chrome.runtime.sendNativeMessage which can be used to send a message to a native application and chrome.runtime.connectNative which allows for a more persistent connection.

    所以,你不能直接执行一个命令,但你可以有一个本机
    应用程序为你做。

    So, you can't directly execute a command, but you can have a native app do it for you.

    你可以找到更多信息文档中的本地消息

    通过 http://stackoverflow.com/a/19917672/1085891

    这篇关于chrome / chrome扩展:通过上下文菜单运行可执行文件/脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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