Can't connect to Native messaging host

464 Views Asked by At

Here are my files:

manifest.json

{
    "manifest_version": 2,
    "name": "Open Cyberduck",
    "description": "This extension will open apps",
    "version": "1.0",
    "browser_action": {
        "default_icon": "icon.png",
        "default_popup": "popup.html"
    },  
    "permissions": [
        "activeTab",
        "nativeMessaging"
    ]
}

popup.html

<html>
    <body>
        <button id="mybutton">click me</button>
        <script src="popup.js"></script>
    </body>
</html>

popup.js

var button = document.getElementById("mybutton");
button.addEventListener("click", function() {
    var port = chrome.runtime.connectNative('foobar');
    console.log(port);
}, false);

fzManifest.json (host manifest)

{
    "name": "foobar",
    "description": "My Application",
    "path": "C:\\Program Files\\Cyberduck\\Cyberduck.exe",
    "type": "stdio",
    "allowed_origins": [
        "chrome-extension://ofaogbmpoachbgnfadnlefjkpnogjkpl/"
    ]
}

for registry I ran this command: REG ADD "HKCU\Software\Google\Chrome\NativeMessagingHosts\foobar" /ve /t REG_SZ /d "D:\tests\amgen\plugin\fzManifest.json" /f

Every time I click the extension button it throws this error: Unchecked runtime.lastError: Specified native messaging host not found. Stack Trace: popup.html:0 (anonymous function)

What am I doing wrong?

Cyberduck is an FTP client application.

0

There are 0 best solutions below