简体   繁体   English

为Chrome扩展程序指定本机消息传递主机

[英]Specifying Native Messaging Host for Chrome extension

I am using native messaging API in Chrome extension, and I want to ship the native application within my extension. 我在Chrome扩展程序中使用本机消息传递API,并且想在扩展程序中附带本机应用程序。

In Windows, I add a registry key under HKLM\\SOFTWARE\\Google\\Chrome\\NativeMessagingHosts . 在Windows中,我在HKLM \\ SOFTWARE \\ Google \\ Chrome \\ NativeMessagingHosts下添加一个注册表项。 Since my application is inside the extension folder after installed, I reference the full path by " %LOCALAPPDATA%\\Google\\Chrome\\User Data\\Default\\Extensions\\...\\....json ". 由于安装后我的应用程序位于扩展文件夹中,因此我通过“ %LOCALAPPDATA%\\ Google \\ Chrome \\ User Data \\ Default \\ Extensions \\ ... \\ .... json ”引用了完整路径。 But in this way, my extension complains "Specified native messaging host not found.". 但是以这种方式,我的扩展程序抱怨“找不到指定的本地消息传递主机”。

If I expand the %LOCALAPPDATA% and write the path as " C:\\Users\\...\\AppData\\Local\\Google\\Chrome\\User Data\\Default\\Extensions\\...\\....json ", then my extension can successfully communicate with the host. 如果我展开%LOCALAPPDATA%并将路径写为“ C:\\ Users \\ ... \\ AppData \\ Local \\ Google \\ Chrome \\ User Data \\ Default \\ Extensions \\ ... \\ .... json ”,那么我的扩展程序可以成功与主机通信。

I wonder if this is an intended behavior? 我想知道这是否是预期的行为? Thank you for your help. 谢谢您的帮助。

There is no expansion of environment variables in the current Chromium code . 当前的Chromium代码中没有扩展环境变量。 It sounds like a reasonable feature request, though there might be security reasons not to do it. 这听起来像是一个合理的功能请求,尽管出于安全考虑可能不这样做。 If you file a bug , we'll have a look and see whether it's feasible. 如果您提交了错误 ,我们将看一下是否可行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Google Chrome 扩展程序 - 未找到指定的本机消息传递主机 - Google Chrome Extension - Specified Native Messaging Host Not Found 为什么带有UI的chrome扩展的本机消息传递主机会挂起? - Why would a native messaging host for a chrome extension with a UI hang? Chrome Native Messaging Chrome扩展程序 - Chrome Native Messaging Chrome Extension Chrome扩展原生邮件同步 - Chrome extension Native messaging synchronization 如何修复Chrome浏览器扩展程序中的本机主机已退出错误-本机消息传递 - How to fix Native Host Has Exited error in Chrome browser extension — Native Messaging Chrome:本机消息传递错误:禁止访问指定的本机消息传递主机 - Chrome : Native messaging Error: Access to the specified native messaging host is forbidden 从扩展名与本机消息传递主机通信时出错 - Error when communicating with the native messaging host from extension 为什么我得到Chrome Native Messaging“找不到指定的本地消息传递主机。”? - Why am I getting Chrome Native Messaging “Specified native messaging host not found.”? Chrome 本地消息传递 — 为什么我会收到“未找到指定的本地消息传递主机”错误? - Chrome Native Messaging — Why am I receiving a “Specified native messaging host not found” error? Chrome 扩展消息帮助 - Chrome Extension Messaging help
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM