3 Star 9 Fork 0

薛定谔的码/ChromeCallNativeExe

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
fengt- fengt 初版 7eda98d 5年前
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Chrome 插件形式调用本地exe程序

项目需要用到网页端调用本地可执行程序。由于chrome安全限制,不能直接调用exe程序。因此,采用chrome插件的形式,使用nativeMessaging调用本地exe程序,并传递参数。

此方式exe程序只能从标准输入读取参数

插件由三个文件组成

  • manifest.json
  • content.js
  • background.js

插件安装

chrome菜单中选择更多工具 -> 扩展程序 -> 打开开发者模式 -> 加载已解压的扩展程序 -> 选择chrome-plugin目录

chrome-plugin

测试方式

使用之前,需要先修改三个地方:

  • test_mainifest.json文件中,将path参数修改为ChromeCall.exe文件的实际位置

  • test_mainifest.json文件中,将chrome-extension参数修改为上述步骤中的实际ID

  • test_mainifest.json文件加入注册表

    注册表位置HKEY_LOCAL_MACHINE\SOFTWARE\Google\Chrome\NativeMessagingHosts新建项com.app.name,并将其值改为文件test_mainifest.json的绝对路径

使用方式

使用chrome打开test_index.html文件,点击"调用本地程序"

chrome-plugin

MIT License Copyright (c) 2020 big当当当当当 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

Chrome浏览器插件调用本地可执行程序 展开 收起
README
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/lessbb/ChromeCallNativeExe.git
git@gitee.com:lessbb/ChromeCallNativeExe.git
lessbb
ChromeCallNativeExe
ChromeCallNativeExe
master

搜索帮助