Answer the question
In order to leave comments, you need to log in
How to use Chrome Native Messaging on Ubuntu?
How to use Chrome Native Messaging on Ubuntu?
Chromium has an extension installed:
manifest.json
{
"manifest_version": 2,
"version": "1.0",
"name": "Native Messaging Example",
"description": "Send a message to a native application",
"permissions": [
"nativeMessaging"
],
"background": {
"scripts": ["native.js"]
}
}
port = chrome.runtime.connectNative('com.google.chrome.example.echo ');
port.onMessage.addListener(function(message) {
alert(message);
});
port.onDisconnect.addListener(function() {
alert(chrome.runtime.lastError.message);
});
port.postMessage({ text: "Hello, my_application" });
Invalid native messaging host name specified
/home/alex/.config/chromium/NativeMessagingHosts/
/home/alex/.config/chromium/Default/NativeMessagingHosts/
/etc/chromium/native-messaging-hosts/
/etc/chromium-browser/native-messaging-hosts/
{
"name": "com.google.chrome.example.echo",
"description": "Chrome Native Messaging API Example Host",
"path": "/home/alex/native/native.sh",
"type": "stdio",
"allowed_origins": [
"chrome-extensions://bpblaklgcafionejfnmigkncnmkaebef/"
]
}
#!/bin/bash
echo "Hello"
exit 0
Answer the question
In order to leave comments, you need to log in
native.sh should act as a daemon. There is a good example in the answer
to stack overflow
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question