[英]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.