chrome / chrome扩展:通过上下文菜单运行可执行文件/脚本

编程入门 行业动态 更新时间:2024-10-28 04:20:28
本文介绍了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 blog.chromium/2013/09/saying-goodbye-to-our-old-friend-npapi.html

    另一种方式,

    Another way, suggested here, is with Java.

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

    实施政策: http:// docs .oracle / 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.

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

    通过 stackoverflow/a/19917672/1085891

  • 更多推荐

    chrome / chrome扩展:通过上下文菜单运行可执行文件/脚本

    本文发布于:2023-11-23 02:24:19,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1619741.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:上下文   脚本   可执行文件   菜单   chrome

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!