All Projects → acandylevey → NativeMessaging

acandylevey / NativeMessaging

Licence: MIT license
C# Chome Native Messaging Library

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to NativeMessaging

sc ext
Sitecore Extensions is a browser extension which improves user experience inside Sitecore CMS
Stars: ✭ 27 (-50.91%)
Mutual labels:  edge, microsoft-edge, edge-extension
edge-contextMenuSearch
Extension for MS Edge browser to provide search option in context menu for selected text
Stars: ✭ 13 (-76.36%)
Mutual labels:  edge, microsoft-edge, edge-extension
Gooreplacer
⚡️⚡️A browser extension to modify HTTP requests :-)
Stars: ✭ 850 (+1445.45%)
Mutual labels:  edge, edge-extension
selenium cdp
Selenium 4x, executing Chrome DevTools Protocol commands
Stars: ✭ 33 (-40%)
Mutual labels:  chromium, edge
Surfingkeys
Map your keys for web surfing, expand your browser with javascript and keyboard.
Stars: ✭ 3,787 (+6785.45%)
Mutual labels:  chromium, edge-extension
WebView4Delphi
WebView4Delphi is an open source project created by Salvador Díaz Fau to embed Chromium-based browsers in applications made with Delphi or Lazarus/FPC for Windows.
Stars: ✭ 157 (+185.45%)
Mutual labels:  chromium, edge
Webextension Toolbox
Small CLI toolbox for cross-browser WebExtension development
Stars: ✭ 365 (+563.64%)
Mutual labels:  edge, edge-extension
chrome-flags
💐 My personal Chromium-based flags
Stars: ✭ 13 (-76.36%)
Mutual labels:  chromium, microsoft-edge
pocketizer
Unofficial Pocket new tab extension for Chrome, Firefox, and Edge
Stars: ✭ 43 (-21.82%)
Mutual labels:  edge, edge-extension
Mue
Fast, open and free-to-use new tab page for modern browsers
Stars: ✭ 56 (+1.82%)
Mutual labels:  chromium, edge
Edge Selenium Tools
An updated EdgeDriver implementation for Selenium 3 with newly-added support for Microsoft Edge (Chromium).
Stars: ✭ 41 (-25.45%)
Mutual labels:  chromium, edge
Netflix 4k Ddplus
MicrosoftEdge(Chromium core) extension to play Netflix in 4K(Restricted)and DDplus audio
Stars: ✭ 128 (+132.73%)
Mutual labels:  chromium, edge
web-extension-boilerplate
The web extension boilerplate help to set up project quickly using typescript, jest, webpack, githook, prettier and github actions
Stars: ✭ 35 (-36.36%)
Mutual labels:  edge, microsoft-edge
xcloud-keyboard-mouse
Chrome extension for controlling Xbox Cloud Gaming (Project xCloud) using a keyboard and mouse
Stars: ✭ 78 (+41.82%)
Mutual labels:  edge, edge-extension
quickjira
🚤 📂 Quickly access the JIRA of your choice by typing the ticket id
Stars: ✭ 65 (+18.18%)
Mutual labels:  edge, edge-extension
flutter-webview-windows
A WebView2-powered Flutter WebView implementation for the Windows platform.
Stars: ✭ 83 (+50.91%)
Mutual labels:  chromium, edge
libedge
Microsoft Edge Microsoft Edge主页算法
Stars: ✭ 17 (-69.09%)
Mutual labels:  edge, microsoft-edge
web-ext-deploy
A tool for deploying WebExtensions to multiple stores.
Stars: ✭ 28 (-49.09%)
Mutual labels:  edge, edge-extension
Chrome Charset
An extension used to modify the page default encoding for Chromium 55+ based browsers.
Stars: ✭ 346 (+529.09%)
Mutual labels:  chromium, edge
Extension Create
Create modern cross-browser extensions with no build configuration.
Stars: ✭ 167 (+203.64%)
Mutual labels:  chromium, edge

NativeMessaging

C# Chome Native Messaging Library

Can be used to receive data from or talk to a Chrome, Edge or any other Chromium based browser extension.

https://www.nuget.org/packages/NativeMessaging/#

This can currently be used with the example app provided here: https://chromium.googlesource.com/chromium/src/+/master/chrome/common/extensions/docs/examples/api/nativeMessaging

Usage

Extend the host class and decide what you want to do when you receive a message.

public class MyHost : Host
    {
        private const bool SendConfirmationReceipt = true;

        public override string Hostname
        {
            get { return "com.anewtonlevey.myhost"; }
        }

        public MyHost() : base(SendConfirmationReceipt)
        {

        }

        protected override void ProcessReceivedMessage(JObject data)
        {
            SendMessage(data);
        }
    }
class Program
    {
        static public string AssemblyLoadDirectory
        {
            get
            {
                string codeBase = Assembly.GetEntryAssembly().CodeBase;
                UriBuilder uri = new UriBuilder(codeBase);
                string path = Uri.UnescapeDataString(uri.Path);
                return Path.GetDirectoryName(path);
            }
        }

		static public string AssemblyExecuteablePath
		{
			get
			{
				string codeBase = Assembly.GetEntryAssembly().CodeBase;
				UriBuilder uri = new UriBuilder(codeBase);
				return Uri.UnescapeDataString(uri.Path);
			}
		}

        static Host Host;

        static string[] AllowedOrigins = new string[] { "chrome-extension://knldjmfmopnpolahpmmgbagdohdnhkik/" };
        static string Description = "Description Goes Here";

        static void Main(string[] args)
        {
            Host = new MyHost();
	    Host.SupportedBrowsers.Add(ChromiumBrowser.GoogleChrome);
	    Host.SupportedBrowsers.Add(ChromiumBrowser.MicrosoftEdge);

            if (args.Contains("--register"))
            {
                Host.GenerateManifest(Description, AllowedOrigins);
                Host.Register();
            } else if(args.Contains("--unregister"))
            {
                Host.UnRegister();
            } else
            {
                Host.Listen();
            }
        }
    }

Troubleshooting

If your're having trouble connecting from Chrome try launching chrome with --enable-logging flag as detailed in Debugging native messaging.

It also recommeneded to try compiling in Release mode if you're encountering issues.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].