1

I am writing an extension need to run at document start. I tried placing the code outside appAPI.ready in the extension.js file but it's still running too late. In chrome I use the "run_at": "document_start" option. How can I do the same in my Crossrider extension.

1 Answers1

1

To run code a document start, you inject the script via the background.js code using the [appAPI.dom.onDocumentStart.addJS][1] method. For example:

appAPI.dom.onDocumentStart.addJS({
  js:"alert('hello world!');"
});

[Disclosure: I am a Crossrider employee]

[1] http://docs.crossrider.com/#!/api/appAPI.dom.onDocumentStart-method-addJS

Shlomo
  • 3,763
  • 11
  • 16