Chrome extension native messaging got error:“Specified native messaging host not found.”

此生再无相见时 提交于 2019-12-11 08:24:06

问题


My platform OS is win 7. I started to write extension and try to communicate with C++ app. Here is manifest of my app: (xxx is my extension id)

{
  "name": "com.google.chrome.testc",
  "path": "D:\\testC\\debug\\testC.exe",
  "description": "My Application",
  "type": "stdio",
  "allowed_origins": [
  "chrome-extension://xxx/"
  ]
}

And I also add registry key at: HKEY_LOCAL_MACHINE\SOFTWARE\Google\Chrome\NativeMessagingHosts: "com.google.chrome.testc: D:\testC\debug\manifest.json"

But when extension called "chrome.runtime.sendNativeMessage('com.google.chrome.testc', ...)", it always report "Specified native messaging host not found.".

What step I missed? or something wrong above? Thanks.


回答1:


The registry key should be HKEY_LOCAL_MACHINE\SOFTWARE\Google\Chrome\NativeMessagingHosts\com.my_company.my_application, and it's (Default) value should be D:\testC\debug\manifest.json.

From your description it seems that you are instead adding a string value with name com.my_company.my_application under the key HKEY_LOCAL_MACHINE\SOFTWARE\Google\Chrome\NativeMessagingHosts



来源:https://stackoverflow.com/questions/21181265/chrome-extension-native-messaging-got-errorspecified-native-messaging-host-not

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!