Skip to main content
A Chrome/Edge extension that leverages the Native Messaging API to bridge the browser and the host operating system — demonstrated here by launching Notepad, but designed with a broader execution scope in mind.

Components

Extension Files

Native Host Files

How It Works

  1. Extension → Native Host: The extension calls chrome.runtime.connectNative() to open a persistent connection.
  2. Message Format: JSON messages prefixed with a 4-byte length header (standard Native Messaging protocol).
  3. Native Host → System: The Python script receives the JSON command and executes it via subprocess.Popen().
  4. Response: The native host sends a JSON status message back to the extension.

Customization

Edit native_host.py to launch different applications, execute custom commands, process files before opening, or return richer status information — the extension shell stays the same.