Skip to content

Alkhioz/ChromeExtensionNativeMessaging

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Chrome Native Messaging Host Setup

1. Compile the Host Binary

From the project directory:

gcc -o hostapp host.c
chmod +x hostapp

2. Get Your Extension ID

  1. Open Chrome and go to chrome://extensions
  2. Enable Developer mode (toggle in the top right)
  3. Find your extension — the ID is the 32-character string shown below the extension name

Extension ID location

⚠️ If your extension is loaded unpacked without a fixed key in its manifest.json, the ID changes every time you reload it. To pin it, add a key field — see Chrome docs.


3. Create the Native Messaging Manifest

Create a file named com.ext.nattest.json (must match the name field exactly):

{
  "name": "com.ext.nattest",
  "description": "Native Messaging Host",
  "path": "/absolute/path/to/your/hostapp",
  "type": "stdio",
  "allowed_origins": [
    "chrome-extension://YOUR_EXTENSION_ID_HERE/"
  ]
}

⚠️ path must be absolute. Chrome does not expand ~ or relative paths. Use the full path, e.g. /Users/yourname/nativemessaging/hostapp.


4. Register the Manifest with Chrome

Copy the manifest to the directory Chrome scans at launch:

cp com.ext.nattest.json \
  ~/Library/Application\ Support/Google/Chrome/NativeMessagingHosts/

Platform paths

Browser Path
Chrome (macOS) ~/Library/Application Support/Google/Chrome/NativeMessagingHosts/
Chrome Canary (macOS) ~/Library/Application Support/Google/Chrome Canary/NativeMessagingHosts/
Chromium (macOS) ~/Library/Application Support/Chromium/NativeMessagingHosts/
Chrome (Linux) ~/.config/google-chrome/NativeMessagingHosts/
Chrome (Windows) Registry key under HKCU\Software\Google\Chrome\NativeMessagingHosts\

About

A chrome extension to interact with a c app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors