Notes GopherJS Chrome Extension Affirm Lang        1

Local Storage example:        1

March 15 2018  Session.        2

Events accessible by Chrome extensions        3

Actions that might be useful        3

Most direct Solution Found so Far        3

Notes GopherJS Chrome Extension Affirm Lang

Github Docs for GopherJS

Initial Work:


sChrome Extension API:

A Shared app built in gopherjs

So it’s a horrible choice to think in javascript dom and then write.  

Gopherjs could be a good option for Controller code.  Not for views of any kind.

Who can make me great at this?  Well it’s a good game. Somehow we should love on a lake.  Creeping thru wrong desires.  

Local Storage example:

js.Global.Get("localStorage").Call("setItem", key, str)

item := js.Global.Get("localStorage").Call("getItem", key)

What’s the point of this:

type Router struct {



Js Object

So We have a decent example. No idea if your exampling is good.  

The full list of what an extension can do:

  1. Extensions can interact with web pages or servers using content scripts 
  2. orcross-origin XMLHttpRequests. Extensions can also interact programmatically with browser features such
  3. asbookmarks and tabs.


go get -u

So where is csv via url?  

March 15 2018  Session.

Need confirm gopherjs can produce calls to chrome features.




Replacing html:

So I know the target javascript to execute but not sure how to make my extension work.

This worked for updating

chrome.browserAction.onClicked.addListener(function(tab) {

   // No tabs or host permissions needed!

   console.log('Turning ' + tab.url + ' red!');


       code: 'document.body.innerHTML ="<div> Hello Darian </div>"'



Smart Cool


 "name": "Page Redder",

 "description": "Make the current page red",

 "version": "2.0",

 "permissions": [



 "background": {

   "scripts": ["background.js"],

   "persistent": false


 "browser_action": {

   "default_title": "Make this page red"


 "manifest_version": 2


Events accessible by Chrome extensions

  1. onStartup
  2. onInstalled
  3. onSuspend
  4. onSuspendCanceled
  5. onUpdateAvailable
  6. onBrowserUpdateAvailable
  7. onConnect
  8. onConnectExternal
  9. onMessage
  10. onMessageExternal
  11. onRestartRequired

Actions that might be useful

  1. getURL
  2. reload
  3. getBackgroundPage 
  4. sendMessage 

Damn this implies what I want to do is completely disallowed

But this implies it is possible:

Most direct example yet:

chrome.tabs.query(object queryInfo, function callback)

To fix the preceding code, you must use that callback parameter. The following code shows how to define a callback function that gets the results from query() (as a parameter named tab) and calls update().

chrome.tabs.query({'active': true}, function(tabs) {
 chrome.tabs.update(tabs[0].id, {url: newUrl});

Most direct Solution Found so Far

  1. The webRequest API, specifically the onBeforeRequest event. (Even better, the upcoming declarativeWebRequest API).

What is event page vs background page?  Man Chrome Browser super involved.  

"persistent": true

Argh, stackoverflow has failed me.  Now going to try event page.  

Fuck every example is failing.  

"name": "Event Page Example" gives the following Failure: