gpt4 book ai didi

google-chrome - Chrome / Chrome 扩展名: run a executable/script via the context menu

转载 作者:行者123 更新时间:2023-12-04 03:51:57 25 4
gpt4 key购买 nike

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

最简单的 和/或最干净的方法是什么?在我看来,由于chrome的沙箱操作,这是不可能的。

最佳答案

这可以通过via NPAPI Plugins完成。

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.



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

Warning

NPAPI is being phased out. Consider using alternatives.

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



通过 Start an external application from a Google Chrome Extension?

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.org/2013/09/saying-goodbye-to-our-old-friend-npapi.html
  • 另一种方法suggested here是Java。

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

    Implementing Policy: http://docs.oracle.com/javase/tutorial/security/userperm/policy.html

  • 使用sendNativeMessage:

    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.

    You can find more info on Native Messaging in the docs.



    通过https://stackoverflow.com/a/19917672/1085891
  • 关于google-chrome - Chrome / Chrome 扩展名: run a executable/script via the context menu,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21007116/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com