从 Google Chrome 扩展程序启动外部应用程序?
如何从 Google Chrome 扩展程序启动外部应用程序?
所以基本上我有一个可执行文件,当您启动它时它会执行该工作。我需要能够在没有窗口的情况下启动它(它是一个控制台应用程序)并在参数中将当前 URL 传递给它,
How to start an external application from a Google Chrome Extension?
So basically I have an executable file which does the job when you launch it. I need to be able to start it without a window (it is a console application) and pass the current URL to it in an argument,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
以前,您可以通过NPAPI 插件来执行此操作。
不过,Google 正在逐步淘汰 NPAPI Chrome,因此首选方法是使用原生消息 API 。外部应用程序必须注册本机消息传递主机才能与您的应用程序交换消息。
Previously, you would do this through NPAPI plugins.
However, Google is now phasing out NPAPI for Chrome, so the preferred way to do this is using the native messaging API. The external application would have to register a native messaging host in order to exchange messages with your application.
您无法启动任意命令,但如果您的用户愿意进行一些额外的设置,您可以使用 自定义协议。
例如,您让用户进行设置,以便
some-app://
链接启动“SomeApp”,然后在my-awesome-extension
中打开一个指向的选项卡some-app://some-data-the-app-wants
,就可以开始了!You can't launch arbitrary commands, but if your users are willing to go through some extra setup, you can use custom protocols.
E.g. you have the users set things up so that
some-app://
links start "SomeApp", and then inmy-awesome-extension
you open a tab pointing tosome-app://some-data-the-app-wants
, and you're good to go!原生消息传递主机
Chrome 扩展程序
Native messaging host
Chrome-extensions
Host
Add schema
chrome.runtime.sendNativeMessage
example:
Example repository
I have created a project thunder/e11fde9 whose ultimate goal is to be able to use a browser as input and then open a specified file locally (without a mouse, if possible)
It is still in development, but I think the early code is enough. The link is below.
Which already has a log that records the results of the browser's transmission, while the browser can also get the program's return value.
Reference
It's useful, and it provides a way to use python to communicate.
use golang to communicate.
我选择假设,因为我现在无法验证。
使用 Apache,如果您在本地计算机上创建一个调用可执行文件的 php 脚本,然后通过 html/javascript 通过 POST 或 GET 调用该脚本?
它会起作用吗?
让我知道。
I go for hypothesys since I can't verify now.
With Apache, if you make a php script on your local machine calling your executable, and then call this script via POST or GET via html/javascript?
would it function?
let me know.