Webextensions were my gateway into programming and they still hold a spot in my heart. As you make more though, you may find their capabilities limited. This is were native messaging comes in.
A WebExtension can spawn a process on your computer and communicate with it through standard input and output. Your browser will be in charge of spawning the process and doing the redirection of messages.
I use this trick to save my browsing metadata to a database for later inspection; e.g. every github repository is saved to disk including author name, repo name, description, topics, languages, etc.
Building the native end of a WebExtension is not tricky but is severely under-documented and the tools around it are not the best. This is why I’m publishing a go package today.
This package makes it very easy to implement a process to respond to WebExtension’s messages.
The API exposed is very similar to the one in the net/http
package. You implement the
native.Handler interface and off you go!
While the package is not complete it works and I am using it as the basis for my other WebExtensions.